hydra-haskell (empty) → 0.16.0
raw patch · 13 files changed
+8275/−0 lines, 13 filesdep +basedep +containersdep +hydra-kernel
Dependencies added: base, containers, hydra-kernel, scientific
Files
- CHANGELOG.md +1106/−0
- LICENSE +201/−0
- hydra-haskell.cabal +48/−0
- src/main/haskell/Hydra/Dsl/Haskell/Environment.hs +179/−0
- src/main/haskell/Hydra/Dsl/Haskell/Syntax.hs +3858/−0
- src/main/haskell/Hydra/Haskell/Coder.hs +852/−0
- src/main/haskell/Hydra/Haskell/Environment.hs +24/−0
- src/main/haskell/Hydra/Haskell/Language.hs +171/−0
- src/main/haskell/Hydra/Haskell/Operators.hs +139/−0
- src/main/haskell/Hydra/Haskell/Serde.hs +448/−0
- src/main/haskell/Hydra/Haskell/Syntax.hs +770/−0
- src/main/haskell/Hydra/Haskell/Testing.hs +220/−0
- src/main/haskell/Hydra/Haskell/Utils.hs +259/−0
+ CHANGELOG.md view
@@ -0,0 +1,1106 @@+# Hydra changelog++All notable changes to the Hydra project are documented in this file.++This changelog tracks changes across all Hydra implementations+(Haskell, Java, Python, Scala, TypeScript, Clojure, Common Lisp, Emacs Lisp, Scheme)+and supporting infrastructure.++The format is inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)+and [Apache TinkerPop](https://github.com/apache/tinkerpop/blob/master/CHANGELOG.asciidoc).++Pre-1.0 versions are listed below.+Untagged versions correspond to in-repository version bumps that were not pushed as Git tags or Hackage releases;+they are documented here for completeness.++---++## [0.16.0] - 2026-06-09++Major themes: primitive-metadata reification, self-hosting coder DSLs with all+eight hosts passing the common test suite, finalized `hydra.packaging`, and a+deep kernel-vocabulary cleanup.++### Highlights++- **`PrimitiveDefinition` and per-namespace registry modules** with host-independent+ specs for every standard-library primitive ([#156](https://github.com/CategoricalData/hydra/issues/156), [#319](https://github.com/CategoricalData/hydra/issues/319)).+- **Self-hosting coder DSLs; all eight hosts pass the common test suite**, including+ the completed TypeScript head ([#344](https://github.com/CategoricalData/hydra/issues/344), [#126](https://github.com/CategoricalData/hydra/issues/126)).+- **Finalized `hydra.packaging`** and a unified `Module.dependencies` field ([#369](https://github.com/CategoricalData/hydra/issues/369), [#354](https://github.com/CategoricalData/hydra/issues/354)).+- **Kernel-vocabulary cleanup**: `maybe`→`optional` across kernel and hosts, plus+ order-preserving JSON objects ([#401](https://github.com/CategoricalData/hydra/issues/401), [#398](https://github.com/CategoricalData/hydra/issues/398)).++### New features++- Reify `PrimitiveDefinition` in `hydra.packaging` with per-namespace `hydra.lib.<sub>` registries ([#156](https://github.com/CategoricalData/hydra/issues/156)).+- Host-independent `comments` specifications for all standard-library primitives ([#319](https://github.com/CategoricalData/hydra/issues/319)).+- Kernel-oriented style checks in `hydra.validate.*` ([#321](https://github.com/CategoricalData/hydra/issues/321), [#351](https://github.com/CategoricalData/hydra/issues/351), [#352](https://github.com/CategoricalData/hydra/issues/352)), on a reshaped validation API ([#320](https://github.com/CategoricalData/hydra/issues/320)).+- Promote the JSON Schema coder to a full DSL coder ([#350](https://github.com/CategoricalData/hydra/issues/350)).+- Transpose coder sources into host-native DSLs for self-hosting ([#344](https://github.com/CategoricalData/hydra/issues/344), [#358](https://github.com/CategoricalData/hydra/issues/358)).+- `Term`-typed annotations replacing `Map<Name, Term>` ([#386](https://github.com/CategoricalData/hydra/issues/386)).+- Language-specific EDSL features on the kernel `Language` ([#233](https://github.com/CategoricalData/hydra/issues/233)).+- Primitive-metadata-driven laziness in eager coders ([#391](https://github.com/CategoricalData/hydra/issues/391)).+- `/test` skill and `bin/test.sh` for target-language test validation ([#387](https://github.com/CategoricalData/hydra/issues/387)).+- Automatic differentiation: a `grad` transform ([#324](https://github.com/CategoricalData/hydra/issues/324)).+- `hydra.show.error.pg` for `InvalidGraphError` ([#374](https://github.com/CategoricalData/hydra/issues/374)).++### Improvements++- Finalize `hydra.packaging`: `Binding`→`TypeDefinition`, `Module`/`Package` `comments`, `moduleName` cleanup ([#369](https://github.com/CategoricalData/hydra/issues/369), [#396](https://github.com/CategoricalData/hydra/issues/396), [#402](https://github.com/CategoricalData/hydra/issues/402), [#404](https://github.com/CategoricalData/hydra/issues/404)).+- Merge `Module.termDependencies`/`typeDependencies` into one `dependencies` field ([#354](https://github.com/CategoricalData/hydra/issues/354)).+- Resolve the `maybe`/`optional` ambiguity across kernel and all hosts ([#401](https://github.com/CategoricalData/hydra/issues/401)).+- Order-preserving JSON objects; order-sensitive `Value` equality ([#398](https://github.com/CategoricalData/hydra/issues/398)).+- Rename `Namespace`→`ModuleName` ([#316](https://github.com/CategoricalData/hydra/issues/316)) and the phantom DSL types to `Typed*` ([#397](https://github.com/CategoricalData/hydra/issues/397)).+- Move from a type-class enum to type-class names ([#275](https://github.com/CategoricalData/hydra/issues/275)).+- Repackage "eval lib" modules as kernel lib modules; promote remaining sources ([#260](https://github.com/CategoricalData/hydra/issues/260), [#355](https://github.com/CategoricalData/hydra/issues/355), [#356](https://github.com/CategoricalData/hydra/issues/356)).+- Reshape `hydra.context` into `InferenceContext` ([#368](https://github.com/CategoricalData/hydra/issues/368)).+- Streamline the Haskell, Java, Python, and Scala syntax models, re-pinning Java to SE 21 and Python to the 3.14 PEG grammar ([#297](https://github.com/CategoricalData/hydra/issues/297)).+- Adopt persistent immutable collections across hosts ([#359](https://github.com/CategoricalData/hydra/issues/359), [#360](https://github.com/CategoricalData/hydra/issues/360), [#361](https://github.com/CategoricalData/hydra/issues/361), [#362](https://github.com/CategoricalData/hydra/issues/362)).+- Migrate underscored kernel definition names to camelCase ([#348](https://github.com/CategoricalData/hydra/issues/348)).+- Tidy qualified/unqualified imports in the Haskell DSL sources ([#308](https://github.com/CategoricalData/hydra/issues/308)).+- Eliminate the `Hydra.Module.Compat` shim ([#315](https://github.com/CategoricalData/hydra/issues/315)).+- Homogenize writer conventions across target languages ([#339](https://github.com/CategoricalData/hydra/issues/339)).+- Disambiguate format-version field naming across JSON metadata ([#412](https://github.com/CategoricalData/hydra/issues/412)).+- Per-package DSL→JSON build with per-package incremental inference ([#381](https://github.com/CategoricalData/hydra/issues/381), [#395](https://github.com/CategoricalData/hydra/issues/395)).+- Prune stale `dist/` outputs; self-heal digests; exclude digests from VCS; reconcile drift; fail loud ([#357](https://github.com/CategoricalData/hydra/issues/357), [#393](https://github.com/CategoricalData/hydra/issues/393), [#405](https://github.com/CategoricalData/hydra/issues/405), [#378](https://github.com/CategoricalData/hydra/issues/378), [#379](https://github.com/CategoricalData/hydra/issues/379), [#392](https://github.com/CategoricalData/hydra/issues/392), [#414](https://github.com/CategoricalData/hydra/issues/414)).+- Accept all valid (host, target) pairs in the generation drivers ([#421](https://github.com/CategoricalData/hydra/issues/421)).+- Move Gradle build infrastructure into `heads/java/`; remove top-level `pixi.toml` ([#384](https://github.com/CategoricalData/hydra/issues/384), [#385](https://github.com/CategoricalData/hydra/issues/385)).+- Eliminate post-generation test patches; fix loader/runner kludges; re-enable test timing ([#307](https://github.com/CategoricalData/hydra/issues/307), [#309](https://github.com/CategoricalData/hydra/issues/309), [#311](https://github.com/CategoricalData/hydra/issues/311)).+- Performance/benchmarks and usability assessments ([#277](https://github.com/CategoricalData/hydra/issues/277), [#283](https://github.com/CategoricalData/hydra/issues/283)).+- Split the Hackage distribution into per-package distributions ([#418](https://github.com/CategoricalData/hydra/issues/418)).++### Bug fixes++- Encode `uint32` JSON literals as numbers, not strings ([#431](https://github.com/CategoricalData/hydra/issues/431)).+- Satisfy or suppress warnings in generated Java ([#349](https://github.com/CategoricalData/hydra/issues/349)).+- Restore JSON parser test cases (polymorphic case handling, ordering fallback) ([#336](https://github.com/CategoricalData/hydra/issues/336)).+- Keep annotations through `termAlternatives`/`typeAlternatives` adaptation ([#353](https://github.com/CategoricalData/hydra/issues/353)).+- Scala host decodes module JSON containing term definitions ([#342](https://github.com/CategoricalData/hydra/issues/342)).+- Java coder: fix exponential `let`-bound `cases` cost ([#372](https://github.com/CategoricalData/hydra/issues/372)) and explicit type args on `PersistentMap.ofEntries` ([#394](https://github.com/CategoricalData/hydra/issues/394)).+- Python-host codegen: drop extra `pyStringToPyStrings` wrapping ([#367](https://github.com/CategoricalData/hydra/issues/367)).+- `escape_literal_char` no longer mangles RDF triples ([#363](https://github.com/CategoricalData/hydra/issues/363)).+- Sync robustness: stale coder JSON, omitted native modules, dead helper, bad source dirs ([#406](https://github.com/CategoricalData/hydra/issues/406), [#400](https://github.com/CategoricalData/hydra/issues/400), [#411](https://github.com/CategoricalData/hydra/issues/411), [#408](https://github.com/CategoricalData/hydra/issues/408)).+- Cross-host self-hosting fixes (Scala, TypeScript, and the four Lisp dialects) ([#422](https://github.com/CategoricalData/hydra/issues/422), [#423](https://github.com/CategoricalData/hydra/issues/423), [#424](https://github.com/CategoricalData/hydra/issues/424), [#429](https://github.com/CategoricalData/hydra/issues/429), [#444](https://github.com/CategoricalData/hydra/issues/444), [#366](https://github.com/CategoricalData/hydra/issues/366), [#389](https://github.com/CategoricalData/hydra/issues/389), [#407](https://github.com/CategoricalData/hydra/issues/407), [#425](https://github.com/CategoricalData/hydra/issues/425), [#426](https://github.com/CategoricalData/hydra/issues/426), [#427](https://github.com/CategoricalData/hydra/issues/427), [#432](https://github.com/CategoricalData/hydra/issues/432), [#438](https://github.com/CategoricalData/hydra/issues/438), [#439](https://github.com/CategoricalData/hydra/issues/439), [#443](https://github.com/CategoricalData/hydra/issues/443)).++### Removed++- Removed the `bigfloat` literal type from `FloatType` and `FloatValue` ([#330](https://github.com/CategoricalData/hydra/issues/330)).+ Arbitrary-precision floating-point values were inconsistently supported+ across host languages (Java/Scala in particular lacked a true IEEE 754+ arbitrary-precision implementation), and nothing in the codebase relied on+ them. `FloatType` and `FloatValue` now have only `float32` and `float64`+ variants. Removed library primitives: `bigfloatToBigint`, `bigfloatToFloat32`,+ `bigfloatToFloat64`, `bigintToBigfloat`, `float32ToBigfloat`,+ `float64ToBigfloat`, `readBigfloat`, `showBigfloat`, `roundBigfloat`. New+ primitives `float32ToFloat64` and `float64ToFloat32` (the latter lossy)+ replace the removed bigfloat-routed conversions.+- Removed `heads/haskell/bin/assemble-hackage-sdist.sh` ([#418](https://github.com/CategoricalData/hydra/issues/418)), the 0.15-era+ bridge that flattened the multi-source-dir Haskell head into one self-contained+ `hydra` sdist. Superseded by the per-package assembler (see Improvements).++### Documentation++- Comprehensive documentation refresh for 0.16 ([#383](https://github.com/CategoricalData/hydra/issues/383))+ spanning nine tracks across READMEs, `docs/`, the wiki, CLAUDE.md, and+ in-source kernel comments.+- New `docs/json-format.md` reference describing the canonical JSON wire format+ (tagged-union duality, optional-field rules, IEEE 754 sentinels, integer+ threshold).+- New wiki pages: `Design` (rationale behind each major choice) and `Inference`+ (HM type inference with class constraints).+- Cross-checked every prose doc against current code; corrected drift in+ primitive-checking sections of `docs/recipes/maintenance.md`, the `Primitive`+ shape in `docs/implementation.md` and `docs/recipes/adding-primitives.md`,+ and the build-system narrative.+- Wove motivation ("the why") through the existing doc surface rather than+ collecting it into separately-titled sidebars; landed an inference-overview+ centerpiece on the wiki ([#377](https://github.com/CategoricalData/hydra/issues/377)).+- Aligned doc vocabulary with the LambdaGraph paper and the literature review+ for the design space Hydra inhabits.+- Net-new READMEs for `packages/hydra-kernel`, `packages/hydra-ext`,+ `packages/hydra-coq`, and `packages/hydra-wasm`; top-level `README.md`+ now carries a canonical packages table.+- Audited and refreshed the Claude surface: CLAUDE.md "Where to look up X"+ table extended with rows for `docs/getting-started.md`, `docs/json-format.md`,+ and the `Design` / `Inference` wiki pages; hard-rules block reordered by+ violation frequency; `claude/pitfalls.md` superseded entries folded into+ `docs/troubleshooting.md` / recipes.+- Project-descriptor strings reviewed and aligned across 24 build / packaging+ files (Hackage synopsis, Maven Central description, PyPI / conda-forge+ classifiers, Hydra-format `package.json` files).+- `docs/index.html` (the GitHub Pages landing page) refreshed with audience+ hops into wiki Concepts / Design, `docs/getting-started.md`, and the GitHub+ repo, plus the full published-artifact list across Hackage, Maven Central,+ PyPI, and conda-forge.+- In-source kernel-code rationale comments added at key Sources sites covering+ injection / pair / either / unit-void duality, error taxonomy, variant+ records, inference-context threading, validation profiles, reduction state,+ lexical filters, name mangling, scoping, variable handling, defaults+ integration, and Tarjan SCC choice rationale. JSON encode/decode modules+ cross-reference `docs/json-format.md`.+- Filed `Primitive.implementation` carrier-simplification follow-up+ ([#446](https://github.com/CategoricalData/hydra/issues/446))+ to drop the unused `InferenceContext` and `Graph` parameters once the+ `Lib/Defaults/` integration ([#437](https://github.com/CategoricalData/hydra/issues/437))+ lands.++---++## [0.15.0] - 2026-04-29++A structural-cleanup release.+The repository is reorganized into a three-tree+`packages/` (DSL sources) / `heads/` (per-host runtime) / `dist/` (generated output)+layout ([#290](https://github.com/CategoricalData/hydra/issues/290)), the kernel is simplified ([#251](https://github.com/CategoricalData/hydra/issues/251), [#292](https://github.com/CategoricalData/hydra/issues/292), [#332](https://github.com/CategoricalData/hydra/issues/332)), and Java + Python now+ship as per-package publishable artifacts on Maven Central / PyPI / conda-forge+([#305](https://github.com/CategoricalData/hydra/issues/305)).+Incremental, content-hash-based caches accelerate the sync pipeline ([#247](https://github.com/CategoricalData/hydra/issues/247)).+Three new generation-only targets — Coq ([#326](https://github.com/CategoricalData/hydra/issues/326)), WebAssembly ([#325](https://github.com/CategoricalData/hydra/issues/325)), and an+automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324)) — are in progress as Claude collaborations.++### Highlights++- **Three-tree repository layout**: `packages/` (DSL), `heads/` (host runtime),+ `dist/` (generated) ([#290](https://github.com/CategoricalData/hydra/issues/290)).+- **Per-package distributions** for Java (4 Maven artifacts) and Python (5 wheels):+ `hydra-kernel`, `hydra-pg`, `hydra-rdf`, `hydra-{java,python}`, plus `hydra-ext`+ on PyPI ([#305](https://github.com/CategoricalData/hydra/issues/305)).+- **Kernel simplifications**: `Function`/`Elimination` removed ([#332](https://github.com/CategoricalData/hydra/issues/332)),+ `FunctionPrimitive` removed ([#251](https://github.com/CategoricalData/hydra/issues/251)), `Hydra.Ext.*` prefix retired ([#331](https://github.com/CategoricalData/hydra/issues/331)),+ `Context` error wrapper gone ([#292](https://github.com/CategoricalData/hydra/issues/292)).+- **Incremental caches** across the sync pipeline; ~70x speedup on no-op resync ([#247](https://github.com/CategoricalData/hydra/issues/247)).+- **JSON kernel format v1** with formal wire-format spec and four-field rename ([#343](https://github.com/CategoricalData/hydra/issues/343)).+- **Three new generation-only targets** (in progress): Coq ([#326](https://github.com/CategoricalData/hydra/issues/326)), WebAssembly ([#325](https://github.com/CategoricalData/hydra/issues/325)),+ automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324)).++### New features++- Per-package distributions ([#305](https://github.com/CategoricalData/hydra/issues/305)): standalone Maven / PyPI / conda-forge builds,+ generated `build.gradle` / `pyproject.toml` per package, transitive dep resolution.+- JSON kernel format v1 ([#343](https://github.com/CategoricalData/hydra/issues/343)): formal spec at `docs/json-format.md`,+ four-field rename to `typeScheme`, `Module` field reorder, `formatVersion` stamp.+- `decimal` literal type in the kernel ([#338](https://github.com/CategoricalData/hydra/issues/338)) across all hosts.+- Type-directed JSON encoder with idiomatic optional encoding ([#314](https://github.com/CategoricalData/hydra/issues/314), [#318](https://github.com/CategoricalData/hydra/issues/318)).+- Incremental type inference plus content-hash caches ([#247](https://github.com/CategoricalData/hydra/issues/247)).+- Coq generation target ([#326](https://github.com/CategoricalData/hydra/issues/326), in progress): `hydra-coq` package, 131/131 `.v` files pass `coqc`.+- WebAssembly target ([#325](https://github.com/CategoricalData/hydra/issues/325), in progress): `hydra-wasm` package, M4 closure mechanism.+- Automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324), in progress): symbolic source-to-source.+- `hydra.show.error` module ([#265](https://github.com/CategoricalData/hydra/issues/265)): consolidated error-message builders.+- `hydra.lib.maybes.toList` primitive ([#257](https://github.com/CategoricalData/hydra/issues/257)).+- NaN / Inf round-tripping through JSON and per-language serdes ([#312](https://github.com/CategoricalData/hydra/issues/312), [#318](https://github.com/CategoricalData/hydra/issues/318), [#330](https://github.com/CategoricalData/hydra/issues/330)).+- Typeclass inference test group ([#274](https://github.com/CategoricalData/hydra/issues/274)).+- Term and type linters ([#232](https://github.com/CategoricalData/hydra/issues/232)).+- Validation for modules and graphs ([#155](https://github.com/CategoricalData/hydra/issues/155)).+- User-defined-function (UDF) support and DSL-vs-primitive overrides+ ([#62](https://github.com/CategoricalData/hydra/issues/62), [#63](https://github.com/CategoricalData/hydra/issues/63), [#102](https://github.com/CategoricalData/hydra/issues/102), [#158](https://github.com/CategoricalData/hydra/issues/158)).+- Stale-source detection across sync entrypoints ([#228](https://github.com/CategoricalData/hydra/issues/228)).++### Improvements++- Sync infrastructure: matrix tool, per-package orchestrator, per-language wrappers ([#290](https://github.com/CategoricalData/hydra/issues/290)).+- TestGraph post-generation patches eliminated; DSL emits `TestEnv` refs directly.+- Minimized standard imports in generated Haskell ([#161](https://github.com/CategoricalData/hydra/issues/161)); improved auto-aliases ([#322](https://github.com/CategoricalData/hydra/issues/322)).+- Removed kernel term dependencies from the interpreter ([#257](https://github.com/CategoricalData/hydra/issues/257)).+- Removed `Graph` and `Context` arguments from primitive implementations ([#266](https://github.com/CategoricalData/hydra/issues/266)).+- Refactored kernel term modules: split rewriting/schemas, renamed show.meta → codegen,+ moved `Coder` to `coders`, merged `extract.helpers` ([#221](https://github.com/CategoricalData/hydra/issues/221)).+- Removed Aeson and HsYAML dependencies; YAML coder moved to `hydra-ext` ([#261](https://github.com/CategoricalData/hydra/issues/261)).+- Lisp recursive let bindings via SCC ([#341](https://github.com/CategoricalData/hydra/issues/341)); parenthesis cleanup ([#84](https://github.com/CategoricalData/hydra/issues/84)).+- Everything-to-everything bootstrapping demo ([#254](https://github.com/CategoricalData/hydra/issues/254)).+- Re-enabled skipped Python tests; `disabledForPython` retired ([#263](https://github.com/CategoricalData/hydra/issues/263)).+- Promoted host-specific code in `packages/` into per-head locations ([#337](https://github.com/CategoricalData/hydra/issues/337)).+- Migrated `hydra.common` Java module out ([#10](https://github.com/CategoricalData/hydra/issues/10)).+- Test infrastructure unification under `UniversalTestCase` ([#246](https://github.com/CategoricalData/hydra/issues/246)).+- Default property graph → RDF mapping ([#296](https://github.com/CategoricalData/hydra/issues/296)).+- 13 unsafe partial primitives replaced with `Maybe`-returning alternatives ([#201](https://github.com/CategoricalData/hydra/issues/201)).+- Java generated code uses standard `java.util` collection interfaces ([#313](https://github.com/CategoricalData/hydra/issues/313)).+- `Term.union` renamed to `Term.inject` ([#334](https://github.com/CategoricalData/hydra/issues/334)).+- Inconsistencies in domain DSLs cleaned up ([#219](https://github.com/CategoricalData/hydra/issues/219)).+- Coder packages moved out of hydra-haskell ([#182](https://github.com/CategoricalData/hydra/issues/182)).+- Java package-naming scheme revised ([#223](https://github.com/CategoricalData/hydra/issues/223)).+- Decimal used (instead of bigfloat) for JSON numbers ([#340](https://github.com/CategoricalData/hydra/issues/340)).+- Hydra kernel moved out of hydra-haskell ([#282](https://github.com/CategoricalData/hydra/issues/282)).++### Bug fixes++- `substInTypeScheme` capture-unsafe substitution under nested forall binders.+- Java `Float64` arithmetic primitives corrected for current `PrimitiveFunction` API.+- Clojure decimal handling: value-based equality, `BigInteger` return from `decimal_to_bigint`.+- Scheme runtime R7RS imports for `sets.scm` / `maps.scm` / `eithers.map_set`.+- Python coder defaults corrected from `Py.Name` to `Py.Expression`.+- Scala host JSON-decode failure on modules containing term definitions ([#342](https://github.com/CategoricalData/hydra/issues/342)).+- Lisp coder mutually-recursive let bindings for Clojure ([#341](https://github.com/CategoricalData/hydra/issues/341)).++### Documentation++- Documentation refresh for the 0.15 packaging restructure ([#290](https://github.com/CategoricalData/hydra/issues/290), [#331](https://github.com/CategoricalData/hydra/issues/331)); CLAUDE.md,+ READMEs, recipes, demos, and seven wiki pages updated.+- Code-generation recipe rewritten for the per-package dist layout ([#282](https://github.com/CategoricalData/hydra/issues/282)).+- New `maintenance.md` recipe consolidates non-source-file scans, stale generated+ detection, design-violation checks, and freshness checks.+- Documentation style guide added at `docs/documentation-style-guide.md`.+- Cross-worktree messaging protocol documented in CLAUDE.md.+- Decimal type documented in the lexicon and per-language READMEs ([#338](https://github.com/CategoricalData/hydra/issues/338)).+- JSON encoding format docs updated for idiomatic optional encoding ([#314](https://github.com/CategoricalData/hydra/issues/314)).++---++## [0.14.1] - 2026-03-30++Patch release.+Regenerates all implementations after a fix to the group eval primitive ([#281](https://github.com/CategoricalData/hydra/issues/281)),+and relocates the property-graph and RDF/SHACL "ext" modules into hydra-java and hydra-python.++### Improvements++- Moved PG, RDF, and SHACL ext modules from hydra-ext into hydra-java and hydra-python.++### Bug fixes++- Group eval primitive fix; all targets regenerated ([#281](https://github.com/CategoricalData/hydra/issues/281)).+- JavaDoc HTML-entity escaping in generated `DestructuringPattern.java`.++---++## [0.14.0] - 2026-03-29++Major release adding four new complete Hydra implementations — Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)),+Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)), Common Lisp, and Scheme — bringing the total to seven bootstrapping hosts+(plus Emacs Lisp, which passes the test suite but does not yet participate in bootstrapping).+Also includes kernel simplifications, an Avro bidirectional coder ([#301](https://github.com/CategoricalData/hydra/issues/301)),+eval primitives ([#281](https://github.com/CategoricalData/hydra/issues/281)), new demos, and significant performance work on the Scheme host.++### Highlights++- **Four new complete implementations**: Hydra-Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)), Hydra-Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)),+ Hydra-Common Lisp, and Hydra-Scheme pass the common test suite and can serve as+ bootstrapping hosts.+ The four Lisp dialects share a single coder and serializer.+- **Kernel simplifications**: removed `RowType`/`WrappedType` ([#82](https://github.com/CategoricalData/hydra/issues/82)),+ unified `Graph`/`TypeContext`/`InferenceContext` ([#192](https://github.com/CategoricalData/hydra/issues/192)),+ replaced `Module.elements` with `Module.definitions` ([#214](https://github.com/CategoricalData/hydra/issues/214)),+ consolidated error types ([#268](https://github.com/CategoricalData/hydra/issues/268)), and promoted all staging modules to DSL sources ([#267](https://github.com/CategoricalData/hydra/issues/267)).+- **Avro bidirectional coder** ([#301](https://github.com/CategoricalData/hydra/issues/301)) with property graph pipeline demo.+- **Scheme bootstrap performance**: 58 minutes → 5.7 minutes via O(1) vhash data structures+ and IEEE 754 float precision fixes.++### Breaking changes++- Removed legacy adapter framework; replaced by the staging-promoted variant ([#236](https://github.com/CategoricalData/hydra/issues/236), [#295](https://github.com/CategoricalData/hydra/issues/295)).+- Replaced legacy Flow monad with Either ([#245](https://github.com/CategoricalData/hydra/issues/245)).+- Removed `Module.elements`; use `Module.definitions` ([#214](https://github.com/CategoricalData/hydra/issues/214)).+- Removed `RowType` and `WrappedType` ([#82](https://github.com/CategoricalData/hydra/issues/82)).+- Renamed `hydra.accessors` to `hydra.paths` ([#271](https://github.com/CategoricalData/hydra/issues/271)).+- Renamed `hydra.tarjan` and merged into `hydra.sorting` ([#220](https://github.com/CategoricalData/hydra/issues/220)).+- Merged `hydra.constraints` into `hydra.query` ([#272](https://github.com/CategoricalData/hydra/issues/272)).+- Moved `hydra.workflow` to hydra-ext ([#270](https://github.com/CategoricalData/hydra/issues/270)).+- Consolidated `hydra.compute` into `hydra.util` ([#269](https://github.com/CategoricalData/hydra/issues/269)).+- Removed `hydra.describe` ([#216](https://github.com/CategoricalData/hydra/issues/216)) and types from `hydra.mantle` ([#217](https://github.com/CategoricalData/hydra/issues/217)).+- Replaced `OtherError` with task-specific error types ([#268](https://github.com/CategoricalData/hydra/issues/268)).+- Java: lowered minimum Java version to 11 ([#249](https://github.com/CategoricalData/hydra/issues/249)).+- Java: `Pair` replaces `Tuple2` ([#252](https://github.com/CategoricalData/hydra/issues/252)); `Comparable` implemented for generated classes ([#131](https://github.com/CategoricalData/hydra/issues/131)).++### New features++- Hydra-Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)): complete implementation, sbt/Scala 3, 3043 tests.+- Hydra-Lisp: Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)), Common Lisp, Emacs Lisp, Scheme — four dialects,+ one coder. CI workflows for Clojure, Common Lisp, and Scheme.+- Avro bidirectional coder ([#301](https://github.com/CategoricalData/hydra/issues/301)) with demo.+- Eval primitives ([#281](https://github.com/CategoricalData/hydra/issues/281)): Logic, Equality, Math, collections, and Groups.+- Generated DSL modules ([#180](https://github.com/CategoricalData/hydra/issues/180)): `hydra.dsls` generates DSL helpers from type modules.+- New demos: GraphQL+JSON ([#279](https://github.com/CategoricalData/hydra/issues/279)), PG validation ([#284](https://github.com/CategoricalData/hydra/issues/284)), SHACL ([#294](https://github.com/CategoricalData/hydra/issues/294)), Avro+PG.+- Packaging module ([#290](https://github.com/CategoricalData/hydra/issues/290)): `hydra.packaging` with `Package` type and validation.+- New primitives: `lists.foldr` ([#280](https://github.com/CategoricalData/hydra/issues/280)), `maybes.toList`, float rounding ([#264](https://github.com/CategoricalData/hydra/issues/264), [#285](https://github.com/CategoricalData/hydra/issues/285)).+- Cross-language benchmarking suite ([#234](https://github.com/CategoricalData/hydra/issues/234)).+- Limited typeclass inference ([#164](https://github.com/CategoricalData/hydra/issues/164)).+- Standardized validation patterns across modules ([#291](https://github.com/CategoricalData/hydra/issues/291)).++### Improvements++- Promoted all staging modules to DSL sources ([#267](https://github.com/CategoricalData/hydra/issues/267)).+- Removed legacy adapters, JSON/YAML coders, grammar framework ([#236](https://github.com/CategoricalData/hydra/issues/236), [#295](https://github.com/CategoricalData/hydra/issues/295)).+- Java: efficient immutable data structures ([#193](https://github.com/CategoricalData/hydra/issues/193)); flattened term naming.+- Java: hidden specialized collection classes in type-level files ([#313](https://github.com/CategoricalData/hydra/issues/313)).+- Inference error messages improved ([#231](https://github.com/CategoricalData/hydra/issues/231)).+- Combined nested let bindings in the Haskell coder ([#248](https://github.com/CategoricalData/hydra/issues/248)).+- Simplified `hydra.adapt.simple` ([#255](https://github.com/CategoricalData/hydra/issues/255)).+- Removed Haskell operators dependency from tests ([#288](https://github.com/CategoricalData/hydra/issues/288)).+- Regression tests for non-Haskell/Java coders ([#85](https://github.com/CategoricalData/hydra/issues/85)).+- Regex support added ([#293](https://github.com/CategoricalData/hydra/issues/293)).+- `hydra.annotations.isNativeType` revisited ([#214](https://github.com/CategoricalData/hydra/issues/214)).+- Migrated grammar-generated models ([#295](https://github.com/CategoricalData/hydra/issues/295)).+- `<<= -shouldBe-> <<~` operator change ([#276](https://github.com/CategoricalData/hydra/issues/276)).+- Minimize Generation.hs ([#225](https://github.com/CategoricalData/hydra/issues/225)).+- Implemented missing Flows primitives ([#183](https://github.com/CategoricalData/hydra/issues/183)).+- Removed JavaDocs from the repository ([#262](https://github.com/CategoricalData/hydra/issues/262)).+- Floating-point test portability fixes for Linux CI ([#264](https://github.com/CategoricalData/hydra/issues/264), [#285](https://github.com/CategoricalData/hydra/issues/285)).+- Moved YAML coder to hydra-ext ([#224](https://github.com/CategoricalData/hydra/issues/224)).+- Minimized native Python and Java primitives in favor of DSL implementations ([#244](https://github.com/CategoricalData/hydra/issues/244)).+- Removed the `disabledForPython` test tag ([#250](https://github.com/CategoricalData/hydra/issues/250)).++### Release tooling++- 0.14 release tracking ([#304](https://github.com/CategoricalData/hydra/issues/304)).++### Documentation++- Thorough cleanup of user documentation ([#302](https://github.com/CategoricalData/hydra/issues/302), [#303](https://github.com/CategoricalData/hydra/issues/303)).+- Coding style guide added to wiki.+- Updated 'new implementation' recipe with learnings from Clojure head ([#278](https://github.com/CategoricalData/hydra/issues/278)).++---++## [0.13.0] - 2026-02-27++Major release completing Hydra-Python ([#66](https://github.com/CategoricalData/hydra/issues/66)) and Hydra-Java ([#166](https://github.com/CategoricalData/hydra/issues/166)) as self-hosting Hydra implementations+and demonstrating mutual self-hosting across all three languages.+Significant improvements to type inference, type checking, rewriting, and adaptation.+New language features include first-class Either types, typeclass inference, binary data support,+and a native JSON parser/writer.+Comprehensive tooling for cross-implementation bootstrapping+and provisional support for Go, Rust, and JavaScript targets.++### Highlights++- **Mutual self-hosting across three implementations**: Hydra is now fully self-hosting+ in Haskell ([#179](https://github.com/CategoricalData/hydra/issues/179)), Java, and Python, and can cross-generate between every combination+ of host and target language (9 paths total).+- **Hydra-Java is complete** ([#166](https://github.com/CategoricalData/hydra/issues/166)): all kernel and generation tests pass.+- **Hydra-Python is complete** ([#66](https://github.com/CategoricalData/hydra/issues/66)): 100% test parity with Haskell.+- **Language coders promoted into the Hydra kernel** ([#176](https://github.com/CategoricalData/hydra/issues/176)): Haskell, Java, and Python+ coders are now defined as Hydra DSL modules, making them self-hosting.+- **Either type support** ([#210](https://github.com/CategoricalData/hydra/issues/210)) with full inference, checking, and library support.+- **Native JSON parser and writer** ([#188](https://github.com/CategoricalData/hydra/issues/188), [#243](https://github.com/CategoricalData/hydra/issues/243), [#253](https://github.com/CategoricalData/hydra/issues/253)): Hydra's own JSON parser and writer+ replace the Aeson dependency; bootstrap-from-JSON architecture for cross-implementation+ code generation.++### Breaking changes++- Renamed `Optional` to `Maybe` throughout the codebase ([#204](https://github.com/CategoricalData/hydra/issues/204)):+ `hydra.lib.optionals` → `hydra.lib.maybes`; all `optional` variants renamed to `maybe`.+- Removed unlabeled product and sum types; replaced with pair types ([#212](https://github.com/CategoricalData/hydra/issues/212)).+- Renamed `hydra.core.TypedTerm` to `hydra.core.TypeApplicationTerm`.+- Renamed `hydra.json` to `hydra.json.model`.+- Renamed `hydra.lib.maps.remove` to `hydra.lib.maps.delete`.+- Removed deprecated `hydra.decoding` module.+- Removed old `hydra.mantle.Either` type (replaced by core `Either`).+- Removed `hydra.lib.tuples` library.+- Removed C# coder stub (C# syntax model remains).+- DSL syntax migration: removed `OverloadedStrings` for term expressions ([#238](https://github.com/CategoricalData/hydra/issues/238)).+- Removed `Hydra.Dsl.ShorthandTypes` ([#222](https://github.com/CategoricalData/hydra/issues/222)).++### New features++- Self-hosting in Haskell ([#179](https://github.com/CategoricalData/hydra/issues/179)) and full mutual cross-generation (Haskell ↔ Java ↔ Python).+- New bootstrapping demo validating all 9 paths across 249 modules.+- Promoted Haskell, Java, and Python coders from staging code into Hydra DSL sources ([#176](https://github.com/CategoricalData/hydra/issues/176)).+- JSON-as-source-of-truth bootstrapping architecture ([#243](https://github.com/CategoricalData/hydra/issues/243), [#253](https://github.com/CategoricalData/hydra/issues/253)):+ new executables and scripts enabling `bootstrap-from-json` for cross-implementation+ code generation.+- Generated term encoders and decoders replace legacy hand-coded modules ([#47](https://github.com/CategoricalData/hydra/issues/47)).+- Hydra-Python completion ([#66](https://github.com/CategoricalData/hydra/issues/66)): restructured project layout with `src/main` and+ `src/gen-main` ([#191](https://github.com/CategoricalData/hydra/issues/191)); full library implementations including `hydra.lib.flows`;+ `@lru_cache` optimization for nullary bindings; PyPy compatibility.+- Hydra-Java completion ([#166](https://github.com/CategoricalData/hydra/issues/166)): all kernel and generation tests pass; deep changes+ to Java coder; `Lazy` utility class for delayed evaluation; array-type support+ in Java serde; tail-call optimization in the Java coder; `Tuple` implements `Comparable`.+- Either type ([#210](https://github.com/CategoricalData/hydra/issues/210)): `EitherType`, `either` term constructor, `hydra.lib.eithers` library+ with `either`, `map`, `mapList`, `mapMaybe`, `bimap`, `bind`, `fromLeft`, `fromRight`,+ `isLeft`, `isRight`, `lefts`, `rights`, `partitionEithers`.+- Pair type as a core construct ([#211](https://github.com/CategoricalData/hydra/issues/211)).+- Void type ([#237](https://github.com/CategoricalData/hydra/issues/237)): uninhabited `void` type as the dual of `unit`; type-level only.+- Native JSON parser and writer ([#188](https://github.com/CategoricalData/hydra/issues/188), [#242](https://github.com/CategoricalData/hydra/issues/242)):+ bidirectional JSON encoder/decoder; replaces the Aeson dependency;+ cross-checked via a special test runner.+- Typeclass inference ([#164](https://github.com/CategoricalData/hydra/issues/164)):+ type schemes with typeclass constraints via `TypeVariableMetadata`;+ typeclass metadata on primitive definitions; Haskell coder uses typeclass info.+- Binary/`ByteString` support ([#172](https://github.com/CategoricalData/hydra/issues/172)): binary data via `ByteString` instead of `String`;+ Haskell coder uses `Data.ByteString`; new `binaryToBytes` primitive.+- Parser combinators: new `hydra.parsing` module with combinator types and DSL.+- Higher-order primitive interpreter ([#198](https://github.com/CategoricalData/hydra/issues/198)): all primitives are fully interpretable+ across all three implementations; legacy `requiresInterp` tag removed.+- Let hoisting and flattening: hoisting polymorphic let terms;+ refined hoisting for monomorphic bindings inside polymorphic ones;+ more efficient `liftLambdaAboveLet` ([#202](https://github.com/CategoricalData/hydra/issues/202));+ case-statement hoisting ([#241](https://github.com/CategoricalData/hydra/issues/241)); subterm hoisting helpers.+- Provisional language targets: Go ([#65](https://github.com/CategoricalData/hydra/issues/65)), Rust (with experimental type-level coder),+ JavaScript (syntax model, serde, DSL, generated sources), and Java/Python syntax DSLs.+- New adapter framework ([#236](https://github.com/CategoricalData/hydra/issues/236)): all external coders refactored+ (Haskell, YAML, Scala, JSON Schema, C++, PDL, Protobuf, GraphQL).+- Compact labeled records and variants ([#122](https://github.com/CategoricalData/hydra/issues/122)).+- New primitives:+ `hydra.lib.lists.find`, `hydra.lib.lists.partition`,+ `hydra.lib.flows.withDefault`, `hydra.lib.flows.foldl`,+ `hydra.lib.math.{max,min,abs,pred,signum,succ,even,odd}`,+ `hydra.lib.pairs.bimap`, `hydra.lib.eithers.bind`,+ `hydra.lib.literals.binaryToBytes`, complete `readXxx`/`showXxx` families,+ `hydra.lexical.chooseUniqueName`, `neg` renamed to `negate`,+ full floating-point math primitives in Python ([#208](https://github.com/CategoricalData/hydra/issues/208)).+- DeepCore DSL: a layer one level deeper than the Meta DSLs,+ for programs that construct programs that construct terms.+- `typeOf` implementation ([#168](https://github.com/CategoricalData/hydra/issues/168)).+- Implement `Comparable` for generated Java classes ([#131](https://github.com/CategoricalData/hydra/issues/131)); update of Hydra-Java ([#166](https://github.com/CategoricalData/hydra/issues/166)).+- Compact labeled records exploration ([#122](https://github.com/CategoricalData/hydra/issues/122)).+- Comparison primitives without typeclasses ([#187](https://github.com/CategoricalData/hydra/issues/187)).+- Investigated core support for Either and Flow monads ([#200](https://github.com/CategoricalData/hydra/issues/200)).++### Improvements++- Type system:+ - Refactored `hydra.inference` to create new module `hydra.checking`.+ - Inference checks after unification to prevent schema names from being unified+ with inferred type variables.+ - Type application terms preserved when preparing application terms for Python.+ - Sanity-check tuple projection index against arity during inference.+ - Bind lost type variables in term annotations.+ - Made `extendTypeContextForLet` tolerant of untyped bindings.+- Code generation:+ - Python: support for deeply-nested match statements; more complete `let` support;+ Pythonic syntax for polymorphic function definitions; refinements for complex+ case-hoisting scenarios; performance improvements ([#209](https://github.com/CategoricalData/hydra/issues/209), [#239](https://github.com/CategoricalData/hydra/issues/239), [#240](https://github.com/CategoricalData/hydra/issues/240)); inline+ let/case rewriting for Python targets ([#203](https://github.com/CategoricalData/hydra/issues/203)).+ - Java: method declaration style consistent with calling style.+ - Haskell: standardized typeclass names.+ - Increased maximum trace depth to support more complex sources.+- Common test suite promotion: all tests promoted into a shared, implementation-independent+ test kernel ([#213](https://github.com/CategoricalData/hydra/issues/213)).+- Statically-compiled test suite in Haskell ([#207](https://github.com/CategoricalData/hydra/issues/207)).+- Included all Hydra kernel types in test schema ([#205](https://github.com/CategoricalData/hydra/issues/205)).+- Reorganized Haskell DSL definitions; standardized imports.+- Added TODO comments to all unsafe primitives ([#201](https://github.com/CategoricalData/hydra/issues/201)).+- New `rewriteAndFoldTerm` utility for simultaneous rewriting and folding.+- Lexical helper for dereferencing schema types through aliases.+- Made JSON parser lazy with new `lazy` parser combinator.+- More efficient substitution helpers for empty substitutions.+- Precomputed type/inference context in kernel test runner for performance.+- Property graph encoding and decoding modules promoted into DSL.+- `hydra.tabular` and `hydra.pg.graphson` modules promoted into DSL.+- `hydra.show.*` modules generated into Java and Python.+- Aligned epsilon encoding with the LambdaGraph spec ([#89](https://github.com/CategoricalData/hydra/issues/89)).+- Fixed asymmetry of introductions and eliminations ([#86](https://github.com/CategoricalData/hydra/issues/86), [#134](https://github.com/CategoricalData/hydra/issues/134)).+- Minimized inferred type annotations ([#114](https://github.com/CategoricalData/hydra/issues/114)).+- Investigated combining products with records, sums with unions ([#196](https://github.com/CategoricalData/hydra/issues/196), [#212](https://github.com/CategoricalData/hydra/issues/212)).+- Refined type reduction in adapters ([#144](https://github.com/CategoricalData/hydra/issues/144)).+- Investigation of unification issues ([#163](https://github.com/CategoricalData/hydra/issues/163)).+- Refactored RowType ([#82](https://github.com/CategoricalData/hydra/issues/82)).+- LLM-assisted PG schemas and mappings ([#171](https://github.com/CategoricalData/hydra/issues/171)).+- Simplified unit-valued variants in Python ([#206](https://github.com/CategoricalData/hydra/issues/206)).+- Checked for inconsistencies between Term/TTerm and Type/TType DSLs ([#218](https://github.com/CategoricalData/hydra/issues/218)).+- GenPG demo: refactored to support Haskell, Python, and Java; Python runner;+ Java generation; finalized output format.+- Testing: extended test runners for let hoisting (Haskell, Python, Java);+ floating-point precision tests; ordering tests for `hydra.lib.maps`/`hydra.lib.sets`;+ inference tests for inferred System F terms; case-hoisting test cases; new JSON coder tests;+ thorough test cases for all primitives ([#199](https://github.com/CategoricalData/hydra/issues/199)).++### Bug fixes++- Fixed interpreter bugs causing test failures ([#235](https://github.com/CategoricalData/hydra/issues/235)).+- Fixed bug in type checking in connection with dead code.+- Fixed bug in `removeTypesFromTerm`.+- Fixed bug in `typeOfMap`.+- Fixed 32-bit max int value in `hydra.constants`.+- Fixed numeric precision in Python.+- Added `BigDecimal` support and fixed `uint8` (short) support in Java.+- Fixed Haskell coder with respect to imports for binary literals.+- Excluded `Prelude.encodeFloat` and `Prelude.decodeFloat` from generated Haskell+ due to name collisions.+- Fixed consistency issues in Python primitives:+ `hydra.lib.sets.toList`, `hydra.lib.maps.union` (precedence),+ `hydra.lib.strings.lines`, `hydra.lib.strings.readString` (dequoting),+ `hydra.lib.lists.apply`, `hydra.lib.maps.toList`.+- Fixed Haskell type signature of `hydra.lists.span`.+- Fixed issue with eta expansion of typed terms.+- Fixed shadowing issue in generated encoding modules.+- Added missing alternatives in `hydra.rewriting.rewriteTermM`.++### Documentation++- Updated main README with complete implementation status.+- Added Documentation sections to all implementation READMEs.+- Fixed outdated Code-organization.md (Python now uses `src/gen-main`).+- Fixed incorrect code paths in Implementation.md.+- Added Java section to Testing wiki.+- Comprehensive developer recipes in `docs/recipes/`.+- Documentation for tail-call optimization implementation.+- Added Haddock comments to Haskell primitives.+- Created wiki page on the release process ([#194](https://github.com/CategoricalData/hydra/issues/194)).++### Community++- Accepted babeloff's `isTrivialTerm` changes.++---++## [0.12.0] - 2025-08-28++A consolidation release: significant Python progress, kernel-level cleanup,+and a wave of bookkeeping closures for Hydra-Java module ports.++### Breaking changes++- Removed `hydra.decoding` module ([#190](https://github.com/CategoricalData/hydra/issues/190)).+- Flattened dependency tiers; eliminated tier-1, tier-2, tier-3 organization ([#184](https://github.com/CategoricalData/hydra/issues/184)).+- Removed `typed` term variant ([#173](https://github.com/CategoricalData/hydra/issues/173), [#162](https://github.com/CategoricalData/hydra/issues/162)).+- Module naming changes: moved tabular and relational modules into kernel ([#152](https://github.com/CategoricalData/hydra/issues/152)).+- Standardized on uncurried helper functions in term-level DSLs ([#174](https://github.com/CategoricalData/hydra/issues/174)).+- Renamed `hydra.lib.flows.traverseOptional` to `hydra.lib.flows.mapOptional`.+- Eliminated camel-cased namespace parts from the kernel ([#152](https://github.com/CategoricalData/hydra/issues/152)).+- Replaced list and optional eliminations with primitive functions ([#150](https://github.com/CategoricalData/hydra/issues/150)).+- Moved `Hydra.Ext` to hydra-ext ([#178](https://github.com/CategoricalData/hydra/issues/178)); moved 'ext' sources into hydra-ext ([#189](https://github.com/CategoricalData/hydra/issues/189)).++### New features++- Significant progress toward Hydra-Python completion:+ generated all kernel types and terms into Python;+ added `Decimal` support for bigfloat values;+ environment tracking for variable scoping;+ generated `hydra.languages` into Python;+ `__hash__` and `__eq__` on serializable generated classes ([#160](https://github.com/CategoricalData/hydra/issues/160)).+- Designated `unit` term and type variants ([#186](https://github.com/CategoricalData/hydra/issues/186)).+- `hydra.lib.flows.mapElems` and `hydra.lib.flows.mapKeys` utilities.+- Promoted JSON coder into the DSL ([#181](https://github.com/CategoricalData/hydra/issues/181)).+- Promoted JSON utilities into the DSL ([#181](https://github.com/CategoricalData/hydra/issues/181)).+- C# coder ([#139](https://github.com/CategoricalData/hydra/issues/139)).+- GQL model and parser ([#140](https://github.com/CategoricalData/hydra/issues/140)).+- Tabular adapters ([#142](https://github.com/CategoricalData/hydra/issues/142)).+- Type-level C++ coder ([#170](https://github.com/CategoricalData/hydra/issues/170)).+- Variable-types-to-Haskell-typedefs transformation ([#70](https://github.com/CategoricalData/hydra/issues/70)).+- A newline at the end of each generated file ([#154](https://github.com/CategoricalData/hydra/issues/154)).+- Refactor kernel modules and primitives by connectivity ([#177](https://github.com/CategoricalData/hydra/issues/177)).++### Improvements++- Condensed repeated elements in error traces ([#165](https://github.com/CategoricalData/hydra/issues/165)).+- Fixed transitive schema dependencies ([#185](https://github.com/CategoricalData/hydra/issues/185)).+- Improved adapter solution with respect to literals.+- Better handling of type variables in Python coder.+- Enhanced term-level Python generation with proper ordering to minimize forward references.+- Topo-sort helper function for dependency management.+- Updated all Python libraries with latest changes.+- Distinguished between deannotation and detyping of terms.+- Adapted primitives when applying language constraints to a graph.+- Use unqualified names where possible in generated code ([#153](https://github.com/CategoricalData/hydra/issues/153)).+- Eliminated `Data.Graph` (containers) dependency ([#167](https://github.com/CategoricalData/hydra/issues/167)).+- "Close the loop" demonstration ([#175](https://github.com/CategoricalData/hydra/issues/175)).+- Implemented `typeOf` ([#168](https://github.com/CategoricalData/hydra/issues/168)).++### Bug fixes++- Fixed System F terms for records and case statements ([#168](https://github.com/CategoricalData/hydra/issues/168)).+- Fixed issue with transitive type-level module dependencies ([#185](https://github.com/CategoricalData/hydra/issues/185)).+- Corrected handling of variable references in Python application terms.+- Fixed nullary functions in Python (added empty parens).+- Added missing alternatives in `hydra.rewriting.rewriteTermM`.++### Bookkeeping++- Closed long-standing Hydra-Java module-port issues+ ([#9](https://github.com/CategoricalData/hydra/issues/9), [#11](https://github.com/CategoricalData/hydra/issues/11), [#15](https://github.com/CategoricalData/hydra/issues/15), [#16](https://github.com/CategoricalData/hydra/issues/16), [#18](https://github.com/CategoricalData/hydra/issues/18), [#19](https://github.com/CategoricalData/hydra/issues/19), [#20](https://github.com/CategoricalData/hydra/issues/20), [#21](https://github.com/CategoricalData/hydra/issues/21), [#22](https://github.com/CategoricalData/hydra/issues/22), [#23](https://github.com/CategoricalData/hydra/issues/23), [#25](https://github.com/CategoricalData/hydra/issues/25), [#44](https://github.com/CategoricalData/hydra/issues/44), [#45](https://github.com/CategoricalData/hydra/issues/45));+ most of the underlying work shipped in earlier releases.+- Closed Hydra-Java DSL-port issues ([#24](https://github.com/CategoricalData/hydra/issues/24), [#26](https://github.com/CategoricalData/hydra/issues/26), [#27](https://github.com/CategoricalData/hydra/issues/27), [#28](https://github.com/CategoricalData/hydra/issues/28), [#29](https://github.com/CategoricalData/hydra/issues/29)) and+ the Scala/Avro tracking issues ([#77](https://github.com/CategoricalData/hydra/issues/77), [#81](https://github.com/CategoricalData/hydra/issues/81)); these had been resolved+ by earlier releases (Scala in 0.14.0, Avro bidi in 0.14.0).++### Documentation++- Updated Hydra-Haskell README.+- Updated Hydra-Java README with corrected links.+- Updated JavaDocs.++---++## [0.11.0] - 2025-03-16++Untagged in-repository version.+A type-inference rebase release: major restructuring of inference internals+to align with Algorithm W, plus a sweeping removal of explicit type annotations+across the kernel.++### Highlights++- **Inference rebased on Algorithm W** ([#118](https://github.com/CategoricalData/hydra/issues/118)): unify-early strategy ([#146](https://github.com/CategoricalData/hydra/issues/146)),+ infinite-type checks restored ([#116](https://github.com/CategoricalData/hydra/issues/116)), recursive-element inference ([#90](https://github.com/CategoricalData/hydra/issues/90)),+ unified handling of elements and let bindings ([#112](https://github.com/CategoricalData/hydra/issues/112)), minimized manual+ type annotations ([#119](https://github.com/CategoricalData/hydra/issues/119)).+- **`hydra.inference` module** introduced for inference type definitions;+ substitution and unification moved up a level.++### Breaking changes++- Argument order of `Logic.ifElse` changed ([#147](https://github.com/CategoricalData/hydra/issues/147)).++### New features++- Inference test cases promoted into the common test suite ([#148](https://github.com/CategoricalData/hydra/issues/148));+ added "kernel examples" inference tests; more recursion / mutual recursion cases.++### Improvements++- Removed type annotations across all kernel sources ([#119](https://github.com/CategoricalData/hydra/issues/119)).+- Migrated to fully-applied primitive library DSLs ([#157](https://github.com/CategoricalData/hydra/issues/157)).+- Aligned `Graph` and `Element` with `LetBinding` ([#159](https://github.com/CategoricalData/hydra/issues/159)).+- `hydra.core.Unit` recognized by the Haskell coder.+- Refactored inference tests.++### Bug fixes++- Fix for underdetermined type in `hydra.decode`.++---++## [0.10.0] - 2025-02-19++Untagged in-repository version.+Adds Hydra-Python (initial completion), a GraphSON coder,+provisional Hydra-Go support, and dot-separated namespace conventions.++### Highlights++- **Hydra-Python initial completion** ([#80](https://github.com/CategoricalData/hydra/issues/80), [#66](https://github.com/CategoricalData/hydra/issues/66)): Python coder, generated kernel+ modules in Python, and full library implementations across kernel namespaces.+- **GraphSON coder** ([#79](https://github.com/CategoricalData/hydra/issues/79)).+- **Provisional Hydra-Go** ([#65](https://github.com/CategoricalData/hydra/issues/65)).+- **Namespace formatting** standardized to dot-separated form ([#151](https://github.com/CategoricalData/hydra/issues/151)).++### Breaking changes++- All namespaces use dot-separated form ([#151](https://github.com/CategoricalData/hydra/issues/151)).++### New features++- Hydra-Python: Python coder; generated `hydra.coreEncoding`, `hydra.strip`,+ `hydra.literals` and other kernel modules in Python; tuple-expression support;+ updated `hydra.constants` in Python.+- GraphSON coder ([#79](https://github.com/CategoricalData/hydra/issues/79)).+- Provisional Hydra-Go ([#65](https://github.com/CategoricalData/hydra/issues/65)).+- `string-to-char-list` and `char-list-to-string` primitives ([#149](https://github.com/CategoricalData/hydra/issues/149)).+- Restored normalization for generated term variables ([#145](https://github.com/CategoricalData/hydra/issues/145)).++### Improvements++- Re-leveled dependency tiers ([#135](https://github.com/CategoricalData/hydra/issues/135)).+- Updated all Java, Haskell, hydra-ext, and Python primitives to current sources.++---++## [0.9.0] - 2025-01-06++Untagged in-repository version.+Bootstraps Hydra-Python and the JSON Schema coder; introduces a fluent Java DSL for flows.++### Highlights++- **JSON Schema coder** ([#141](https://github.com/CategoricalData/hydra/issues/141)).+- **Python coder scaffold**: serde, language constraints, and generated Haskell+ sources for Python.+- **Fluent-style Java DSL for flows** ([#143](https://github.com/CategoricalData/hydra/issues/143)).++### New features++- JSON Schema coder ([#141](https://github.com/CategoricalData/hydra/issues/141)).+- Python coder scaffold and serde.+- Provisional Python language constraints module.+- Fluent-style Java DSL for flows ([#143](https://github.com/CategoricalData/hydra/issues/143)); moved Flows DSL into `hydra.dsl`.+- New `hydra.coders` DSL.+- New DSL functions for core variants.++### Improvements++- Generalized `Namespaces` so it can be used for languages other than Haskell.+- Local-name-only Python type aliases (the directory tree provides the namespace).+- Coders DSL used to simplify Java language-constraint sources.+- Removed redundant productions in the Python grammar.+- Added unit tests for fluent flows.++### Documentation++- Updated JavaDocs for 0.9.0.++---++## [0.8.1] - 2024-09-24++Patch release.++### Improvements++- Generalized the property graph merging utility to accept type systems other than Hydra Core.++---++## [0.8.0] - 2024-09-09++C# support ([#139](https://github.com/CategoricalData/hydra/issues/139)), Graphviz DOT coder, term accessors, and a small breaking change in Java+to support Spark.++### Breaking changes++- Made `FlowException` serializable for Spark support (may affect existing error handling).++### New features++- C# syntax module based on the Microsoft ANTLR grammar ([#139](https://github.com/CategoricalData/hydra/issues/139)).+- Graphviz DOT coder ([#136](https://github.com/CategoricalData/hydra/issues/136)):+ full support for lambdas and recursive `let` statements;+ compact 'accessor graph' visualization option;+ customizable label styles;+ highlighted let-bound terms; edge labels.+- Term accessor type to facilitate lenses and path-aware transformations.+- OpenGQL grammar and generated Haskell for the OpenGQL model ([#140](https://github.com/CategoricalData/hydra/issues/140)).++### Improvements++- Added `</>` as alternative to `@@` application operator in Haskell DSLs.+- Utilities for working with term accessors.+- More specific exception class for JSON decoding.+- Additional convenience methods on `JsonDecoding.java`.+- Used transitive dependencies in hydra-java and hydra-ext.+- Upgraded ANTLR to address a vulnerability.+- Moved TinkerPop utilities from `hydra/ext/org/apache/tinkerpop` into `hydra/pg`.++---++## [0.7.0] - 2024-08-21++Major refactoring of module organization and namespace management.+Establishes the DNS-style namespace convention in hydra-ext+and lifts property-graph models into a top-level `hydra/pg` namespace.++### Breaking changes++- Namespace reorganization: migrated to DNS-based module naming in hydra-ext ([#138](https://github.com/CategoricalData/hydra/issues/138)):+ `hydra/ext/avro` → `hydra/ext/org/apache/avro`,+ `hydra/ext/graphql` → `hydra/ext/org/graphql`,+ `hydra/ext/yaml` → `hydra/ext/org/yaml`,+ `hydra/ext/json/decoding` → `hydra/ext/org/json/decoding`,+ `hydra/ext/rdf` → `hydra/ext/org/w3/rdf`,+ `hydra/ext/shacl` → `hydra/ext/org/w3/shacl`,+ `hydra/ext/tinkerpop` → `hydra/ext/org/apache/tinkerpop`.+- Property graphs: promoted property graph modules from+ `hydra/ext/org/apache/tinkerpop` to `hydra/pg`.+- Project structure: renamed `hydra-extensions` to `hydra-ext`;+ renamed `hydra/langs` to `hydra/ext` ([#138](https://github.com/CategoricalData/hydra/issues/138));+ made hydra-ext into a Gradle subproject alongside hydra-java;+ added top-level Gradle build.++### Improvements++- Moved TinkerPop modules from hydra-haskell into hydra-ext for better separation.+- Moved miscellaneous models to `Hydra.Ext.Other` ([#138](https://github.com/CategoricalData/hydra/issues/138)).+- Moved XML Schema, SQL, ShEx, and OWL models to hydra-ext.+- Moved KQL, Parquet, and Python modules to hydra-ext.+- Separated JavaDocs for hydra-java and hydra-ext.+- Updated publishing configuration in `build.gradle`.++---++## [0.6.0] - 2024-08-19++Type-system improvements (System F type abstraction/application; eliminated polymorphic+types from Hydra Core), expanded language support (Graphviz DOT model, generated Java+field-name constants), and revamped annotation handling.++### Breaking changes++- Eliminated `InferenceContext` helper type ([#103](https://github.com/CategoricalData/hydra/issues/103)).+- Changed typing environment from `Map Name Type` to `Map Name TypeScheme` in graphs ([#76](https://github.com/CategoricalData/hydra/issues/76)).+- Updated annotations and flows to use `map<Name, Term>` instead of `map<string, Term>` ([#133](https://github.com/CategoricalData/hydra/issues/133)).+- Unified `Name` and `FieldName`; aliased to `string` ([#121](https://github.com/CategoricalData/hydra/issues/121)).+- Renamed `hydra/core.UnitType` to `hydra/core.Unit` ([#123](https://github.com/CategoricalData/hydra/issues/123)).+- Eliminated annotation classes; Hydra has a single built-in notion of annotations ([#113](https://github.com/CategoricalData/hydra/issues/113)).+- Unified the `Nominal` type with `RowType` ([#115](https://github.com/CategoricalData/hydra/issues/115)).+- Removed the `extends` parameter for row types ([#132](https://github.com/CategoricalData/hydra/issues/132)).+- Replaced `hydra/Kv` with `hydra/Annotations` (rename revisited).++### New features++- System F support: `typeAbstraction` and `typeApplication` term constructors.+- Python3 syntax model based on the official Python BNF ([#80](https://github.com/CategoricalData/hydra/issues/80)).+- Graphviz DOT model and initial support ([#136](https://github.com/CategoricalData/hydra/issues/136)).+- Field-name constants generated in Java code generation ([#137](https://github.com/CategoricalData/hydra/issues/137)).+- Provisional Algorithm W implementation in Haskell (originally from @wisnesky), kept for reference.++### Improvements++- Primitive organization: Hydra primitives organized into libraries for namespace management.+- Code generation:+ - Escaped field name constants and `with_` methods in Java coder.+ - Generated field name constants in Java ([#137](https://github.com/CategoricalData/hydra/issues/137)).+ - Avoided duplicated comments in wrapper classes in generated Java.+ - Removed superfluous newtype comments in Haskell coder.+- Updated Delta Parquet model to follow the Java API more closely.+- Enriched OpenCypher features module with the complete list of standard Cypher functions.+- Added convenience methods to `JsonEncoding.java`.+- Restored `Hydra.Inference` subdirectory.+- Allowed arbitrary case for element names ([#7](https://github.com/CategoricalData/hydra/issues/7)).+- Corrected `uint8` representation in Java to `Short` ([#120](https://github.com/CategoricalData/hydra/issues/120)).++### Bug fixes++- Fixed handling of type annotations in term adapters.+- Fixed decoding of encoded terms annotated with a type.+- Corrected encoding of universal types in `showTerm` ([#117](https://github.com/CategoricalData/hydra/issues/117)).++---++## [0.5.3] - 2024-08-06++Patch release.+Preserves order of map key/value pairs and set elements during JSON serialization.++### Bug fixes++- Preserved ordering of key/value pairs and set elements in JSON output.++### New features++- Polymorphic `equal` primitive in Haskell and Java.+- Generated Hydra type definitions together with native instantiations of Hydra types+ in Haskell (a stepping stone toward generated coders, [#47](https://github.com/CategoricalData/hydra/issues/47)).++---++## [0.5.1] - 2024-08-01++Patch release.+Dependency updates and minor improvements following the 0.5.0 Hydra Core overhaul.++### Improvements++- Updated dependencies.++---++## [0.5.0] - 2024-07-26++Untagged in-repository version.+Major Hydra Core overhaul: eliminates polymorphic types in favor of explicit+TypeScheme; consolidates the annotation system; revamps `Let` term encoding.++### Breaking changes++- Eliminated polymorphic types from Hydra Core in Haskell ([#125](https://github.com/CategoricalData/hydra/issues/125)):+ removed type parameters from `hydra/core` types in Hydra-Java; replaced type schemes+ with forall types ([#76](https://github.com/CategoricalData/hydra/issues/76)).+- Revamped core encoding and `Let`: bindings are now a list of+ `(name, term, optional type scheme)` triplets instead of a map.+- Unified typed-term types and moved `TypeScheme` into Hydra Core.+- Eliminated `AnnotationClass`; Hydra has a single built-in notion of annotations now ([#113](https://github.com/CategoricalData/hydra/issues/113)).+- Renamed and refactored phantom-type wrappers ([#128](https://github.com/CategoricalData/hydra/issues/128)); removed deprecated `Reference`+ type from `hydra/phantoms`.+- Removed incomplete support for stream types and stream terms ([#88](https://github.com/CategoricalData/hydra/issues/88)).++### New features++- `LiteralTypes` DSL module so literals can be built independently of terms.+- `Hydra.Minimal` module to facilitate collaboration on Hydra application prototypes.+- `TypeConstraint` type added to the kernel.+- `foldl` primitive in Haskell and Java; DSL uses `foldl` instead of the built-in+ list elimination term by default.++### Improvements++- Improvements to Java and JSON coders; improved untyped JSON coder.+- Pre-order and post-order term-traversal test cases added.+- Refactored type inference tests.+- Restored generated Java (Core through Tier 3) with only a few manual tweaks.+- Element names allow arbitrary case ([#7](https://github.com/CategoricalData/hydra/issues/7)).++---++## [0.4.0] - 2024-07-10++Untagged in-repository version.+Adds null checks to generated Java (breaking, but justified — Hydra-Java disallows nulls),+the Gremlin model, and Protobuf annotation refinements.++### Breaking changes++- Null checks added to constructors and `withXXX()` methods in generated Java;+ null values are no longer permitted in Hydra-Java.+- Removed Java 8 restriction (raised minimum Java version).++### New features++- Gremlin model ([#127](https://github.com/CategoricalData/hydra/issues/127)); generated Haskell for Gremlin.+- `hydra/lib/lists.safeHead` primitive in Haskell (necessary in Java due to eager evaluation).+- Support for Protobuf `deprecated=true` annotation; non-string Protobuf options.+- Java options in generated Protobuf.++### Improvements++- Used `java.util.Objects.requireNonNull` instead of a custom null check in generated Java.+- Added 'automatically generated file' disclaimer to generated Java files.+- Added autogen comments and null checks to (most) generated Java.+- Added necessary schema-level dependencies for built-in modules.+- Added null checks to the Flows DSL in Java.++---++## [0.3.0] - 2024-06-05++Untagged in-repository version.+Adds an OpenCypher parser based on an ANTLR grammar ([#124](https://github.com/CategoricalData/hydra/issues/124)),+a KQL (Kusto Query Language) model and serializer,+a Delta Parquet model,+and an early property graph queries model in the style of Cypher.++### New features++- OpenCypher parser based on the OpenCypher M23 ANTLR grammar ([#124](https://github.com/CategoricalData/hydra/issues/124));+ ANTLR added as a build dependency;+ large Cypher test suite drawn from the Cypher Manual.+- Cypher-to-PG-query transformer (Java; partially implemented).+- Property graph queries DSL and generated property graph query classes in Java.+- Property graph queries model (Cypher / future GQL style).+- KQL (Kusto Query Language) initial model and basic serializer.+- Delta Parquet model with generated sources.++### Improvements++- Java options and `deprecated=true` support in generated Protobuf.+- Convenience methods in Java.++---++## [0.2.0] - 2024-01-10++Hydra-Java 0.2.0 release.+Significant Java tooling and DSL build-out, Protobuf bidirectional coder,+Python3 syntax model ([#80](https://github.com/CategoricalData/hydra/issues/80)), property graph validation ([#100](https://github.com/CategoricalData/hydra/issues/100)),+JSON bidirectional support in Java ([#104](https://github.com/CategoricalData/hydra/issues/104)),+OpenCypher initial model ([#108](https://github.com/CategoricalData/hydra/issues/108)),+Cypher unification, and the start of the typed-DSL story in Haskell.++### New features++- Property graph validation: validator type, optionality on property types,+ customizable id/property handling in the merging adapter, fine-tuned validation,+ comprehensive unit tests in Java ([#100](https://github.com/CategoricalData/hydra/issues/100)).+- Bidirectional JSON serialization/deserialization in Java ([#104](https://github.com/CategoricalData/hydra/issues/104)).+- Checkstyle configuration based on Google style guide ([#111](https://github.com/CategoricalData/hydra/issues/111)).+- Python3 syntax model based on the official Python BNF ([#80](https://github.com/CategoricalData/hydra/issues/80)).+- Initial OpenCypher model and parser scaffold ([#108](https://github.com/CategoricalData/hydra/issues/108)).+- Protobuf coder ([#99](https://github.com/CategoricalData/hydra/issues/99)): type encoder, field numbering, formatting, deprecated annotation,+ Java options, non-string options.+- Adapter framework tolerance of recursive types ([#58](https://github.com/CategoricalData/hydra/issues/58)); default branch for case+ statements ([#60](https://github.com/CategoricalData/hydra/issues/60)).+- Topological sort in type inference ([#67](https://github.com/CategoricalData/hydra/issues/67)).+- `hydra/query` model ([#73](https://github.com/CategoricalData/hydra/issues/73)).+- Records-to-TinkerPop-elements coder ([#64](https://github.com/CategoricalData/hydra/issues/64)).+- Equality primitives for all literal types ([#92](https://github.com/CategoricalData/hydra/issues/92)); polymorphic logic primitives ([#95](https://github.com/CategoricalData/hydra/issues/95)).+- `mapKeys` primitive ([#93](https://github.com/CategoricalData/hydra/issues/93)).+- Tuple support in Java ([#94](https://github.com/CategoricalData/hydra/issues/94)).+- Java 8 as an optional target ([#96](https://github.com/CategoricalData/hydra/issues/96)); optionally generate Java classes as `Serializable` ([#97](https://github.com/CategoricalData/hydra/issues/97)).+- Bidirectional "merged vertex" and "merged edge" coders ([#106](https://github.com/CategoricalData/hydra/issues/106)).+- Nullability and parameterization in the tabular model ([#107](https://github.com/CategoricalData/hydra/issues/107)).+- Term-level / type-level dependency distinction for modules ([#109](https://github.com/CategoricalData/hydra/issues/109)).+- Flatten nested `let` terms for transformation into Java ([#110](https://github.com/CategoricalData/hydra/issues/110)).+- Various `Flow` utilities in Java: `bind3`; convenience methods for consuming results;+ `fromFlow` variants including one that throws.++### Improvements++- Hydra-Java module ports ([#10](https://github.com/CategoricalData/hydra/issues/10), [#12](https://github.com/CategoricalData/hydra/issues/12), [#13](https://github.com/CategoricalData/hydra/issues/13), [#14](https://github.com/CategoricalData/hydra/issues/14), [#17](https://github.com/CategoricalData/hydra/issues/17), [#30](https://github.com/CategoricalData/hydra/issues/30), [#31](https://github.com/CategoricalData/hydra/issues/31), [#32](https://github.com/CategoricalData/hydra/issues/32), [#33](https://github.com/CategoricalData/hydra/issues/33), [#34](https://github.com/CategoricalData/hydra/issues/34), [#35](https://github.com/CategoricalData/hydra/issues/35),+ [#38](https://github.com/CategoricalData/hydra/issues/38), [#39](https://github.com/CategoricalData/hydra/issues/39), [#41](https://github.com/CategoricalData/hydra/issues/41), [#43](https://github.com/CategoricalData/hydra/issues/43), [#48](https://github.com/CategoricalData/hydra/issues/48), [#71](https://github.com/CategoricalData/hydra/issues/71), [#72](https://github.com/CategoricalData/hydra/issues/72), [#75](https://github.com/CategoricalData/hydra/issues/75), [#83](https://github.com/CategoricalData/hydra/issues/83)):+ `Common`, `CoreEncoding`, `CoreLanguage`, `Kernel`, `Flows`, `Lists`, `Literals`,+ `Math`, `Sets`, `Strings`, `Optionals`, `Maps`, `Flows` primitives, `Sets` primitives.+- Common DSLs in Haskell: Flow support ([#68](https://github.com/CategoricalData/hydra/issues/68)), Let support ([#69](https://github.com/CategoricalData/hydra/issues/69)).+- Renamed annotation type parameter `m` to `a` ([#41](https://github.com/CategoricalData/hydra/issues/41)).+- Updated wrapper, element, and variable types ([#75](https://github.com/CategoricalData/hydra/issues/75)).+- Removed `schema` field from `Element` ([#83](https://github.com/CategoricalData/hydra/issues/83)).+- GraphQL coder ([#78](https://github.com/CategoricalData/hydra/issues/78)).+- Code quality:+ - Updated main and test sources to conform to Checkstyle configuration ([#111](https://github.com/CategoricalData/hydra/issues/111)).+ - Extended line-length limit from 100 to 120 characters.+ - Disabled overly restrictive indentation and import-order rules.+ - Disabled `RightCurlyAlone` for compact inline map definitions.+- Streamlined property-graph element merging to unify properties with identical+ keys and types ([#106](https://github.com/CategoricalData/hydra/issues/106)).+- Convenience functions for printing literals and literal types in the Java DSL.+- Minor addition to JSON decoding.+- DSL convenience: alphabetic-case flexibility for element names ([#7](https://github.com/CategoricalData/hydra/issues/7)).++### Bug fixes++- Fixed type annotations for the Sets Java port ([#48](https://github.com/CategoricalData/hydra/issues/48)).+- Various minor fixes during the Java module ports.++---++## [0.1.1] - 2022-12-04++Patch release the same day as 0.1.0.+README polish only.++---++## [0.1.0] - 2022-12-04++First packaged release of Hydra (Hackage).+This release contains the complete foundation of Hydra.++### Core language++- Hydra's core type and data languages (`hydra.core`).+- Core models for graphs and modules.+- Computation model with the `Flow` monad.+- BNF grammars support.+- Phantom types.+- Basic operations on types and terms.++### Type system++- Hindley–Milner-style type inference.+- Type schemes with polymorphism.+- Type/term validation.++### Transformations++- Adapter system: type-to-type rewriting and transformation.+- Coders:+ Haskell coder (types and terms),+ Java coder (types and terms),+ partial Scala coder (terms only),+ Avro coder,+ JSON coder,+ PDL (Pegasus Data Language) coder,+ RDF + SHACL coder,+ YAML coder.++### Language support++- Models for GraphQL, OWL (Web Ontology Language), ShEx (Shape Expressions),+ and TinkerPop-style property graphs.++### Developer tools++- Type-construction DSL and term-construction DSL.+- QuickCheck property-based tests.++### Implementations++- Hydra-Haskell: bootstrapping implementation with full kernel.+- Hydra-Java: Java implementation with mature tooling.++### Community++- Set up the LambdaGraph Discord server ([#2](https://github.com/CategoricalData/hydra/issues/2)).++---++## Contributing++We welcome contributions! Please see:++- [Developer recipes](https://github.com/CategoricalData/hydra/tree/main/docs/recipes)+- [LambdaGraph Discord](https://bit.ly/lg-discord)++## Release process++See the [Release policy](https://github.com/CategoricalData/hydra/wiki/Release-policy)+wiki page and [docs/release-workflow.md](docs/release-workflow.md)+for information on how Hydra releases are versioned, built, and published.
+ LICENSE view
@@ -0,0 +1,201 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.
+ hydra-haskell.cabal view
@@ -0,0 +1,48 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.38.1.+--+-- see: https://github.com/sol/hpack++name: hydra-haskell+version: 0.16.0+synopsis: Hydra's Haskell coder: emit Haskell source from Hydra modules+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". This package is Hydra's Haskell coder: it translates Hydra modules into Haskell source. The top-level entry point is moduleToHaskell (and moduleToHaskellModule for the structured AST). It builds on hydra-kernel.+category: Data+homepage: https://github.com/CategoricalData/hydra#readme+bug-reports: https://github.com/CategoricalData/hydra/issues+author: Joshua Shinavier <josh@fortytwo.net>+maintainer: Joshua Shinavier <josh@fortytwo.net>+license: Apache-2.0+license-file: LICENSE+build-type: Simple+extra-source-files:+ LICENSE+ CHANGELOG.md++source-repository head+ type: git+ location: https://github.com/CategoricalData/hydra++library+ exposed-modules:+ Hydra.Dsl.Haskell.Environment+ Hydra.Dsl.Haskell.Syntax+ Hydra.Haskell.Coder+ Hydra.Haskell.Environment+ Hydra.Haskell.Language+ Hydra.Haskell.Operators+ Hydra.Haskell.Serde+ Hydra.Haskell.Syntax+ Hydra.Haskell.Testing+ Hydra.Haskell.Utils+ other-modules:+ Paths_hydra_haskell+ hs-source-dirs:+ src/main/haskell+ build-depends:+ base >=4.19.0 && <4.22+ , containers >=0.6.7 && <0.8+ , hydra-kernel ==0.16.0+ , scientific >=0.3.7 && <0.4+ default-language: Haskell2010
+ src/main/haskell/Hydra/Dsl/Haskell/Environment.hs view
@@ -0,0 +1,179 @@+-- Note: this is an automatically generated file. Do not edit.+-- | DSL functions for hydra.haskell.environment++module Hydra.Dsl.Haskell.Environment where+import qualified Hydra.Core as Core+import qualified Hydra.Haskell.Environment as Environment+import qualified Hydra.Typed as Typed+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | DSL constructor for hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadata :: Typed.TypedTerm Bool -> Typed.TypedTerm Bool -> Typed.TypedTerm Bool -> Typed.TypedTerm Bool -> Typed.TypedTerm Environment.HaskellModuleMetadata+haskellModuleMetadata usesByteString usesInt usesMap usesSet =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "usesByteString"),+ Core.fieldTerm = (Typed.unTypedTerm usesByteString)},+ Core.Field {+ Core.fieldName = (Core.Name "usesInt"),+ Core.fieldTerm = (Typed.unTypedTerm usesInt)},+ Core.Field {+ Core.fieldName = (Core.Name "usesMap"),+ Core.fieldTerm = (Typed.unTypedTerm usesMap)},+ Core.Field {+ Core.fieldName = (Core.Name "usesSet"),+ Core.fieldTerm = (Typed.unTypedTerm usesSet)}]}))+-- | DSL accessor for the usesByteString field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataUsesByteString :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool+haskellModuleMetadataUsesByteString x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesByteString")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the usesInt field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataUsesInt :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool+haskellModuleMetadataUsesInt x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesInt")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the usesMap field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataUsesMap :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool+haskellModuleMetadataUsesMap x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesMap")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the usesSet field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataUsesSet :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool+haskellModuleMetadataUsesSet x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesSet")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the usesByteString field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesByteString :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool -> Typed.TypedTerm Environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesByteString original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "usesByteString"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "usesInt"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesInt")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesMap"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesMap")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesSet"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesSet")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the usesInt field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesInt :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool -> Typed.TypedTerm Environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesInt original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "usesByteString"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesByteString")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesInt"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "usesMap"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesMap")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesSet"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesSet")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the usesMap field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesMap :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool -> Typed.TypedTerm Environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesMap original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "usesByteString"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesByteString")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesInt"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesInt")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesMap"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "usesSet"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesSet")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the usesSet field of hydra.haskell.environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesSet :: Typed.TypedTerm Environment.HaskellModuleMetadata -> Typed.TypedTerm Bool -> Typed.TypedTerm Environment.HaskellModuleMetadata+haskellModuleMetadataWithUsesSet original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "usesByteString"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesByteString")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesInt"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesInt")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesMap"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.environment.HaskellModuleMetadata"),+ Core.projectionFieldName = (Core.Name "usesMap")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "usesSet"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))
+ src/main/haskell/Hydra/Dsl/Haskell/Syntax.hs view
@@ -0,0 +1,3858 @@+-- Note: this is an automatically generated file. Do not edit.+-- | DSL functions for hydra.haskell.syntax++module Hydra.Dsl.Haskell.Syntax where+import qualified Hydra.Core as Core+import qualified Hydra.Dsl.Core as DslCore+import qualified Hydra.Haskell.Syntax as Syntax+import qualified Hydra.Typed as Typed+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | DSL constructor for hydra.haskell.syntax.Alternative+alternative :: Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.CaseRhs -> Typed.TypedTerm (Maybe Syntax.LocalBindings) -> Typed.TypedTerm Syntax.Alternative+alternative pattern rhs binds =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm pattern)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm rhs)},+ Core.Field {+ Core.fieldName = (Core.Name "binds"),+ Core.fieldTerm = (Typed.unTypedTerm binds)}]}))+-- | DSL accessor for the binds field of hydra.haskell.syntax.Alternative+alternativeBinds :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm (Maybe Syntax.LocalBindings)+alternativeBinds x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "binds")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pattern field of hydra.haskell.syntax.Alternative+alternativePattern :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm Syntax.Pattern+alternativePattern x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the rhs field of hydra.haskell.syntax.Alternative+alternativeRhs :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm Syntax.CaseRhs+alternativeRhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binds field of hydra.haskell.syntax.Alternative+alternativeWithBinds :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm (Maybe Syntax.LocalBindings) -> Typed.TypedTerm Syntax.Alternative+alternativeWithBinds original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "binds"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the pattern field of hydra.haskell.syntax.Alternative+alternativeWithPattern :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.Alternative+alternativeWithPattern original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "binds"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "binds")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the rhs field of hydra.haskell.syntax.Alternative+alternativeWithRhs :: Typed.TypedTerm Syntax.Alternative -> Typed.TypedTerm Syntax.CaseRhs -> Typed.TypedTerm Syntax.Alternative+alternativeWithRhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "binds"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Alternative"),+ Core.projectionFieldName = (Core.Name "binds")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.ApplicationDeclarationHead+applicationDeclarationHead :: Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm Syntax.Variable -> Typed.TypedTerm Syntax.ApplicationDeclarationHead+applicationDeclarationHead function operand =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Typed.unTypedTerm function)},+ Core.Field {+ Core.fieldName = (Core.Name "operand"),+ Core.fieldTerm = (Typed.unTypedTerm operand)}]}))+-- | DSL accessor for the function field of hydra.haskell.syntax.ApplicationDeclarationHead+applicationDeclarationHeadFunction :: Typed.TypedTerm Syntax.ApplicationDeclarationHead -> Typed.TypedTerm Syntax.DeclarationHead+applicationDeclarationHeadFunction x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.projectionFieldName = (Core.Name "function")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the operand field of hydra.haskell.syntax.ApplicationDeclarationHead+applicationDeclarationHeadOperand :: Typed.TypedTerm Syntax.ApplicationDeclarationHead -> Typed.TypedTerm Syntax.Variable+applicationDeclarationHeadOperand x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.projectionFieldName = (Core.Name "operand")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the function field of hydra.haskell.syntax.ApplicationDeclarationHead+applicationDeclarationHeadWithFunction :: Typed.TypedTerm Syntax.ApplicationDeclarationHead -> Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm Syntax.ApplicationDeclarationHead+applicationDeclarationHeadWithFunction original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "operand"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.projectionFieldName = (Core.Name "operand")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the operand field of hydra.haskell.syntax.ApplicationDeclarationHead+applicationDeclarationHeadWithOperand :: Typed.TypedTerm Syntax.ApplicationDeclarationHead -> Typed.TypedTerm Syntax.Variable -> Typed.TypedTerm Syntax.ApplicationDeclarationHead+applicationDeclarationHeadWithOperand original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"),+ Core.projectionFieldName = (Core.Name "function")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "operand"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.ApplicationExpression+applicationExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.ApplicationExpression+applicationExpression function argument =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Typed.unTypedTerm function)},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Typed.unTypedTerm argument)}]}))+-- | DSL accessor for the argument field of hydra.haskell.syntax.ApplicationExpression+applicationExpressionArgument :: Typed.TypedTerm Syntax.ApplicationExpression -> Typed.TypedTerm Syntax.Expression+applicationExpressionArgument x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.projectionFieldName = (Core.Name "argument")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the function field of hydra.haskell.syntax.ApplicationExpression+applicationExpressionFunction :: Typed.TypedTerm Syntax.ApplicationExpression -> Typed.TypedTerm Syntax.Expression+applicationExpressionFunction x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.projectionFieldName = (Core.Name "function")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the argument field of hydra.haskell.syntax.ApplicationExpression+applicationExpressionWithArgument :: Typed.TypedTerm Syntax.ApplicationExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.ApplicationExpression+applicationExpressionWithArgument original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.projectionFieldName = (Core.Name "function")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the function field of hydra.haskell.syntax.ApplicationExpression+applicationExpressionWithFunction :: Typed.TypedTerm Syntax.ApplicationExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.ApplicationExpression+applicationExpressionWithFunction original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationExpression"),+ Core.projectionFieldName = (Core.Name "argument")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.ApplicationPattern+applicationPattern :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.ApplicationPattern+applicationPattern name args =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "args"),+ Core.fieldTerm = (Typed.unTypedTerm args)}]}))+-- | DSL accessor for the args field of hydra.haskell.syntax.ApplicationPattern+applicationPatternArgs :: Typed.TypedTerm Syntax.ApplicationPattern -> Typed.TypedTerm [Syntax.Pattern]+applicationPatternArgs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.projectionFieldName = (Core.Name "args")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.ApplicationPattern+applicationPatternName :: Typed.TypedTerm Syntax.ApplicationPattern -> Typed.TypedTerm Syntax.Name+applicationPatternName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the args field of hydra.haskell.syntax.ApplicationPattern+applicationPatternWithArgs :: Typed.TypedTerm Syntax.ApplicationPattern -> Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.ApplicationPattern+applicationPatternWithArgs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "args"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.ApplicationPattern+applicationPatternWithName :: Typed.TypedTerm Syntax.ApplicationPattern -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.ApplicationPattern+applicationPatternWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "args"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationPattern"),+ Core.projectionFieldName = (Core.Name "args")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.ApplicationType+applicationType :: Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.ApplicationType+applicationType context argument =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Typed.unTypedTerm context)},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Typed.unTypedTerm argument)}]}))+-- | DSL accessor for the argument field of hydra.haskell.syntax.ApplicationType+applicationTypeArgument :: Typed.TypedTerm Syntax.ApplicationType -> Typed.TypedTerm Syntax.Type+applicationTypeArgument x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.projectionFieldName = (Core.Name "argument")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the context field of hydra.haskell.syntax.ApplicationType+applicationTypeContext :: Typed.TypedTerm Syntax.ApplicationType -> Typed.TypedTerm Syntax.Type+applicationTypeContext x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the argument field of hydra.haskell.syntax.ApplicationType+applicationTypeWithArgument :: Typed.TypedTerm Syntax.ApplicationType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.ApplicationType+applicationTypeWithArgument original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the context field of hydra.haskell.syntax.ApplicationType+applicationTypeWithContext :: Typed.TypedTerm Syntax.ApplicationType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.ApplicationType+applicationTypeWithContext original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ApplicationType"),+ Core.projectionFieldName = (Core.Name "argument")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.AsPattern+asPattern :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.AsPattern+asPattern name inner =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)}]}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.AsPattern+asPatternInner :: Typed.TypedTerm Syntax.AsPattern -> Typed.TypedTerm Syntax.Pattern+asPatternInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.AsPattern+asPatternName :: Typed.TypedTerm Syntax.AsPattern -> Typed.TypedTerm Syntax.Name+asPatternName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the inner field of hydra.haskell.syntax.AsPattern+asPatternWithInner :: Typed.TypedTerm Syntax.AsPattern -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.AsPattern+asPatternWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.AsPattern+asPatternWithName :: Typed.TypedTerm Syntax.AsPattern -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.AsPattern+asPatternWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.AsPattern"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.CaseExpression+caseExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm [Syntax.Alternative] -> Typed.TypedTerm Syntax.CaseExpression+caseExpression case_ alternatives =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (Typed.unTypedTerm case_)},+ Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Typed.unTypedTerm alternatives)}]}))+-- | DSL accessor for the alternatives field of hydra.haskell.syntax.CaseExpression+caseExpressionAlternatives :: Typed.TypedTerm Syntax.CaseExpression -> Typed.TypedTerm [Syntax.Alternative]+caseExpressionAlternatives x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.projectionFieldName = (Core.Name "alternatives")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the case field of hydra.haskell.syntax.CaseExpression+caseExpressionCase :: Typed.TypedTerm Syntax.CaseExpression -> Typed.TypedTerm Syntax.Expression+caseExpressionCase x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.projectionFieldName = (Core.Name "case")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the alternatives field of hydra.haskell.syntax.CaseExpression+caseExpressionWithAlternatives :: Typed.TypedTerm Syntax.CaseExpression -> Typed.TypedTerm [Syntax.Alternative] -> Typed.TypedTerm Syntax.CaseExpression+caseExpressionWithAlternatives original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.projectionFieldName = (Core.Name "case")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the case field of hydra.haskell.syntax.CaseExpression+caseExpressionWithCase :: Typed.TypedTerm Syntax.CaseExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.CaseExpression+caseExpressionWithCase original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.CaseExpression"),+ Core.projectionFieldName = (Core.Name "alternatives")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for the hydra.haskell.syntax.CaseRhs wrapper+caseRhs :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.CaseRhs+caseRhs x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.CaseRhs"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.ClassConstraint+classConstraint :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.Type] -> Typed.TypedTerm Syntax.ClassConstraint+classConstraint name types =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "types"),+ Core.fieldTerm = (Typed.unTypedTerm types)}]}))+-- | DSL accessor for the name field of hydra.haskell.syntax.ClassConstraint+classConstraintName :: Typed.TypedTerm Syntax.ClassConstraint -> Typed.TypedTerm Syntax.Name+classConstraintName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the types field of hydra.haskell.syntax.ClassConstraint+classConstraintTypes :: Typed.TypedTerm Syntax.ClassConstraint -> Typed.TypedTerm [Syntax.Type]+classConstraintTypes x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.projectionFieldName = (Core.Name "types")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.haskell.syntax.ClassConstraint+classConstraintWithName :: Typed.TypedTerm Syntax.ClassConstraint -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.ClassConstraint+classConstraintWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "types"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.projectionFieldName = (Core.Name "types")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the types field of hydra.haskell.syntax.ClassConstraint+classConstraintWithTypes :: Typed.TypedTerm Syntax.ClassConstraint -> Typed.TypedTerm [Syntax.Type] -> Typed.TypedTerm Syntax.ClassConstraint+classConstraintWithTypes original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ClassConstraint"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "types"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.ConstrainedType+constrainedType :: Typed.TypedTerm Syntax.Constraint -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.ConstrainedType+constrainedType ctx type_ =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "ctx"),+ Core.fieldTerm = (Typed.unTypedTerm ctx)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the ctx field of hydra.haskell.syntax.ConstrainedType+constrainedTypeCtx :: Typed.TypedTerm Syntax.ConstrainedType -> Typed.TypedTerm Syntax.Constraint+constrainedTypeCtx x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.projectionFieldName = (Core.Name "ctx")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.ConstrainedType+constrainedTypeType :: Typed.TypedTerm Syntax.ConstrainedType -> Typed.TypedTerm Syntax.Type+constrainedTypeType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the ctx field of hydra.haskell.syntax.ConstrainedType+constrainedTypeWithCtx :: Typed.TypedTerm Syntax.ConstrainedType -> Typed.TypedTerm Syntax.Constraint -> Typed.TypedTerm Syntax.ConstrainedType+constrainedTypeWithCtx original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "ctx"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.ConstrainedType+constrainedTypeWithType :: Typed.TypedTerm Syntax.ConstrainedType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.ConstrainedType+constrainedTypeWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "ctx"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ConstrainedType"),+ Core.projectionFieldName = (Core.Name "ctx")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the class variant of hydra.haskell.syntax.Constraint+constraintClass :: Typed.TypedTerm Syntax.ClassConstraint -> Typed.TypedTerm Syntax.Constraint+constraintClass x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Constraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "class"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the tuple variant of hydra.haskell.syntax.Constraint+constraintTuple :: Typed.TypedTerm [Syntax.Constraint] -> Typed.TypedTerm Syntax.Constraint+constraintTuple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Constraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "tuple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the ordinary variant of hydra.haskell.syntax.Constructor+constructorOrdinary :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm Syntax.Constructor+constructorOrdinary x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Constructor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ordinary"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the record variant of hydra.haskell.syntax.Constructor+constructorRecord :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm Syntax.Constructor+constructorRecord x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Constructor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.haskell.syntax.DataDeclaration+dataDeclaration :: Typed.TypedTerm Syntax.DataKeyword -> Typed.TypedTerm [Syntax.Constraint] -> Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm [Syntax.Constructor] -> Typed.TypedTerm [Syntax.DerivingClause] -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclaration keyword context head constructors deriving_ comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Typed.unTypedTerm keyword)},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Typed.unTypedTerm context)},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Typed.unTypedTerm head)},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Typed.unTypedTerm constructors)},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Typed.unTypedTerm deriving_)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.DataDeclaration+dataDeclarationComments :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm (Maybe String)+dataDeclarationComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the constructors field of hydra.haskell.syntax.DataDeclaration+dataDeclarationConstructors :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.Constructor]+dataDeclarationConstructors x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the context field of hydra.haskell.syntax.DataDeclaration+dataDeclarationContext :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.Constraint]+dataDeclarationContext x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the deriving field of hydra.haskell.syntax.DataDeclaration+dataDeclarationDeriving :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.DerivingClause]+dataDeclarationDeriving x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the head field of hydra.haskell.syntax.DataDeclaration+dataDeclarationHead :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm Syntax.DeclarationHead+dataDeclarationHead x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the keyword field of hydra.haskell.syntax.DataDeclaration+dataDeclarationKeyword :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm Syntax.DataKeyword+dataDeclarationKeyword x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithComments :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the constructors field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithConstructors :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.Constructor] -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithConstructors original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the context field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithContext :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.Constraint] -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithContext original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the deriving field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithDeriving :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm [Syntax.DerivingClause] -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithDeriving original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the head field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithHead :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithHead original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "keyword")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the keyword field of hydra.haskell.syntax.DataDeclaration+dataDeclarationWithKeyword :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm Syntax.DataKeyword -> Typed.TypedTerm Syntax.DataDeclaration+dataDeclarationWithKeyword original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keyword"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "context"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "context")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "constructors"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "constructors")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "deriving"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "deriving")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.DataDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the data variant of hydra.haskell.syntax.DataKeyword+dataKeywordData :: Typed.TypedTerm Syntax.DataKeyword+dataKeywordData =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.DataKeyword"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "data"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the newtype variant of hydra.haskell.syntax.DataKeyword+dataKeywordNewtype :: Typed.TypedTerm Syntax.DataKeyword+dataKeywordNewtype =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.DataKeyword"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "newtype"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the data variant of hydra.haskell.syntax.Declaration+declarationData :: Typed.TypedTerm Syntax.DataDeclaration -> Typed.TypedTerm Syntax.Declaration+declarationData x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Declaration"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "data"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the application variant of hydra.haskell.syntax.DeclarationHead+declarationHeadApplication :: Typed.TypedTerm Syntax.ApplicationDeclarationHead -> Typed.TypedTerm Syntax.DeclarationHead+declarationHeadApplication x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.DeclarationHead"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the simple variant of hydra.haskell.syntax.DeclarationHead+declarationHeadSimple :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.DeclarationHead+declarationHeadSimple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.DeclarationHead"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "simple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the type variant of hydra.haskell.syntax.Declaration+declarationType :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm Syntax.Declaration+declarationType x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Declaration"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the typedBinding variant of hydra.haskell.syntax.Declaration+declarationTypedBinding :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm Syntax.Declaration+declarationTypedBinding x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Declaration"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typedBinding"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the valueBinding variant of hydra.haskell.syntax.Declaration+declarationValueBinding :: Typed.TypedTerm Syntax.ValueBinding -> Typed.TypedTerm Syntax.Declaration+declarationValueBinding x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Declaration"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "valueBinding"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.haskell.syntax.DerivingClause wrapper+derivingClause :: Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm Syntax.DerivingClause+derivingClause x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.DerivingClause"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the declaration variant of hydra.haskell.syntax.Export+exportDeclaration :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm Syntax.Export+exportDeclaration x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Export"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "declaration"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the module variant of hydra.haskell.syntax.Export+exportModule :: Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm Syntax.Export+exportModule x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Export"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the application variant of hydra.haskell.syntax.Expression+expressionApplication :: Typed.TypedTerm Syntax.ApplicationExpression -> Typed.TypedTerm Syntax.Expression+expressionApplication x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the case variant of hydra.haskell.syntax.Expression+expressionCase :: Typed.TypedTerm Syntax.CaseExpression -> Typed.TypedTerm Syntax.Expression+expressionCase x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the constructRecord variant of hydra.haskell.syntax.Expression+expressionConstructRecord :: Typed.TypedTerm Syntax.RecordExpression -> Typed.TypedTerm Syntax.Expression+expressionConstructRecord x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "constructRecord"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the do variant of hydra.haskell.syntax.Expression+expressionDo :: Typed.TypedTerm [Syntax.Statement] -> Typed.TypedTerm Syntax.Expression+expressionDo x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "do"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the if variant of hydra.haskell.syntax.Expression+expressionIf :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression+expressionIf x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "if"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the infixApplication variant of hydra.haskell.syntax.Expression+expressionInfixApplication :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Expression+expressionInfixApplication x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "infixApplication"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the lambda variant of hydra.haskell.syntax.Expression+expressionLambda :: Typed.TypedTerm Syntax.LambdaExpression -> Typed.TypedTerm Syntax.Expression+expressionLambda x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the leftSection variant of hydra.haskell.syntax.Expression+expressionLeftSection :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Expression+expressionLeftSection x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "leftSection"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the let variant of hydra.haskell.syntax.Expression+expressionLet :: Typed.TypedTerm Syntax.LetExpression -> Typed.TypedTerm Syntax.Expression+expressionLet x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the list variant of hydra.haskell.syntax.Expression+expressionList :: Typed.TypedTerm [Syntax.Expression] -> Typed.TypedTerm Syntax.Expression+expressionList x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the literal variant of hydra.haskell.syntax.Expression+expressionLiteral :: Typed.TypedTerm Syntax.Literal -> Typed.TypedTerm Syntax.Expression+expressionLiteral x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the rightSection variant of hydra.haskell.syntax.Expression+expressionRightSection :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Expression+expressionRightSection x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "rightSection"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the tuple variant of hydra.haskell.syntax.Expression+expressionTuple :: Typed.TypedTerm [Syntax.Expression] -> Typed.TypedTerm Syntax.Expression+expressionTuple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "tuple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the typeSignature variant of hydra.haskell.syntax.Expression+expressionTypeSignature :: Typed.TypedTerm Syntax.TypedExpression -> Typed.TypedTerm Syntax.Expression+expressionTypeSignature x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeSignature"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the updateRecord variant of hydra.haskell.syntax.Expression+expressionUpdateRecord :: Typed.TypedTerm Syntax.RecordUpdateExpression -> Typed.TypedTerm Syntax.Expression+expressionUpdateRecord x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "updateRecord"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the variable variant of hydra.haskell.syntax.Expression+expressionVariable :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Expression+expressionVariable x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Expression"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.haskell.syntax.Field+field :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.Field+field name type_ comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.Field+fieldComments :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm (Maybe String)+fieldComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.Field+fieldName :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm Syntax.Name+fieldName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.Field+fieldType :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm Syntax.Type+fieldType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.FieldUpdate+fieldUpdate :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.FieldUpdate+fieldUpdate name value =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Typed.unTypedTerm value)}]}))+-- | DSL accessor for the name field of hydra.haskell.syntax.FieldUpdate+fieldUpdateName :: Typed.TypedTerm Syntax.FieldUpdate -> Typed.TypedTerm Syntax.Name+fieldUpdateName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the value field of hydra.haskell.syntax.FieldUpdate+fieldUpdateValue :: Typed.TypedTerm Syntax.FieldUpdate -> Typed.TypedTerm Syntax.Expression+fieldUpdateValue x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.projectionFieldName = (Core.Name "value")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.haskell.syntax.FieldUpdate+fieldUpdateWithName :: Typed.TypedTerm Syntax.FieldUpdate -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.FieldUpdate+fieldUpdateWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.projectionFieldName = (Core.Name "value")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the value field of hydra.haskell.syntax.FieldUpdate+fieldUpdateWithValue :: Typed.TypedTerm Syntax.FieldUpdate -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.FieldUpdate+fieldUpdateWithValue original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FieldUpdate"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the comments field of hydra.haskell.syntax.Field+fieldWithComments :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.Field+fieldWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.Field+fieldWithName :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Field+fieldWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.Field+fieldWithType :: Typed.TypedTerm Syntax.Field -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Field+fieldWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Field"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.FunctionType+functionType :: Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.FunctionType+functionType domain codomain =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Typed.unTypedTerm domain)},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = (Typed.unTypedTerm codomain)}]}))+-- | DSL accessor for the codomain field of hydra.haskell.syntax.FunctionType+functionTypeCodomain :: Typed.TypedTerm Syntax.FunctionType -> Typed.TypedTerm Syntax.Type+functionTypeCodomain x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.projectionFieldName = (Core.Name "codomain")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the domain field of hydra.haskell.syntax.FunctionType+functionTypeDomain :: Typed.TypedTerm Syntax.FunctionType -> Typed.TypedTerm Syntax.Type+functionTypeDomain x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.projectionFieldName = (Core.Name "domain")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the codomain field of hydra.haskell.syntax.FunctionType+functionTypeWithCodomain :: Typed.TypedTerm Syntax.FunctionType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.FunctionType+functionTypeWithCodomain original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.projectionFieldName = (Core.Name "domain")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the domain field of hydra.haskell.syntax.FunctionType+functionTypeWithDomain :: Typed.TypedTerm Syntax.FunctionType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.FunctionType+functionTypeWithDomain original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.FunctionType"),+ Core.projectionFieldName = (Core.Name "codomain")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.IfExpression+ifExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.IfExpression+ifExpression condition then_ else_ =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "condition"),+ Core.fieldTerm = (Typed.unTypedTerm condition)},+ Core.Field {+ Core.fieldName = (Core.Name "then"),+ Core.fieldTerm = (Typed.unTypedTerm then_)},+ Core.Field {+ Core.fieldName = (Core.Name "else"),+ Core.fieldTerm = (Typed.unTypedTerm else_)}]}))+-- | DSL accessor for the condition field of hydra.haskell.syntax.IfExpression+ifExpressionCondition :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression+ifExpressionCondition x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "condition")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the else field of hydra.haskell.syntax.IfExpression+ifExpressionElse :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression+ifExpressionElse x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "else")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the then field of hydra.haskell.syntax.IfExpression+ifExpressionThen :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression+ifExpressionThen x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "then")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the condition field of hydra.haskell.syntax.IfExpression+ifExpressionWithCondition :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.IfExpression+ifExpressionWithCondition original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "condition"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "then"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "then")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "else"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "else")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the else field of hydra.haskell.syntax.IfExpression+ifExpressionWithElse :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.IfExpression+ifExpressionWithElse original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "condition"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "condition")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "then"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "then")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "else"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the then field of hydra.haskell.syntax.IfExpression+ifExpressionWithThen :: Typed.TypedTerm Syntax.IfExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.IfExpression+ifExpressionWithThen original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "condition"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "condition")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "then"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "else"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.IfExpression"),+ Core.projectionFieldName = (Core.Name "else")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.Import+import_ :: Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm (Maybe Syntax.ModuleName) -> Typed.TypedTerm (Maybe Syntax.ImportSpec) -> Typed.TypedTerm Syntax.Import+import_ qualified module_ as spec =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualified"),+ Core.fieldTerm = (Typed.unTypedTerm qualified)},+ Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Typed.unTypedTerm module_)},+ Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Typed.unTypedTerm as)},+ Core.Field {+ Core.fieldName = (Core.Name "spec"),+ Core.fieldTerm = (Typed.unTypedTerm spec)}]}))+-- | DSL accessor for the as field of hydra.haskell.syntax.Import+importAs :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm (Maybe Syntax.ModuleName)+importAs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "as")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the all variant of hydra.haskell.syntax.ImportExportSubspec+importExportSubspecAll :: Typed.TypedTerm Syntax.ImportExportSubspec+importExportSubspecAll =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportExportSubspec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "all"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the list variant of hydra.haskell.syntax.ImportExportSubspec+importExportSubspecList :: Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm Syntax.ImportExportSubspec+importExportSubspecList x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportExportSubspec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the pattern variant of hydra.haskell.syntax.ImportModifier+importModifierPattern :: Typed.TypedTerm Syntax.ImportModifier+importModifierPattern =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportModifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the type variant of hydra.haskell.syntax.ImportModifier+importModifierType :: Typed.TypedTerm Syntax.ImportModifier+importModifierType =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportModifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL accessor for the module field of hydra.haskell.syntax.Import+importModule :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm Syntax.ModuleName+importModule x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "module")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the qualified field of hydra.haskell.syntax.Import+importQualified :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm Bool+importQualified x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "qualified")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the spec field of hydra.haskell.syntax.Import+importSpec :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm (Maybe Syntax.ImportSpec)+importSpec x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "spec")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the hiding variant of hydra.haskell.syntax.ImportSpec+importSpecHiding :: Typed.TypedTerm [Syntax.NamedImportExport] -> Typed.TypedTerm Syntax.ImportSpec+importSpecHiding x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hiding"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the list variant of hydra.haskell.syntax.ImportSpec+importSpecList :: Typed.TypedTerm [Syntax.NamedImportExport] -> Typed.TypedTerm Syntax.ImportSpec+importSpecList x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ImportSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL updater for the as field of hydra.haskell.syntax.Import+importWithAs :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm (Maybe Syntax.ModuleName) -> Typed.TypedTerm Syntax.Import+importWithAs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualified"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "qualified")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "module")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "spec"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "spec")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the module field of hydra.haskell.syntax.Import+importWithModule :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm Syntax.Import+importWithModule original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualified"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "qualified")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "as")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "spec"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "spec")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the qualified field of hydra.haskell.syntax.Import+importWithQualified :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.Import+importWithQualified original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualified"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "module")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "as")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "spec"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "spec")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the spec field of hydra.haskell.syntax.Import+importWithSpec :: Typed.TypedTerm Syntax.Import -> Typed.TypedTerm (Maybe Syntax.ImportSpec) -> Typed.TypedTerm Syntax.Import+importWithSpec original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualified"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "qualified")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "module"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "module")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Import"),+ Core.projectionFieldName = (Core.Name "as")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "spec"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.InfixExpression+infixExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.InfixExpression+infixExpression lhs operator rhs =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Typed.unTypedTerm lhs)},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm operator)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm rhs)}]}))+-- | DSL accessor for the lhs field of hydra.haskell.syntax.InfixExpression+infixExpressionLhs :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Expression+infixExpressionLhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the operator field of hydra.haskell.syntax.InfixExpression+infixExpressionOperator :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Operator+infixExpressionOperator x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the rhs field of hydra.haskell.syntax.InfixExpression+infixExpressionRhs :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Expression+infixExpressionRhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the lhs field of hydra.haskell.syntax.InfixExpression+infixExpressionWithLhs :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.InfixExpression+infixExpressionWithLhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the operator field of hydra.haskell.syntax.InfixExpression+infixExpressionWithOperator :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.InfixExpression+infixExpressionWithOperator original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the rhs field of hydra.haskell.syntax.InfixExpression+infixExpressionWithRhs :: Typed.TypedTerm Syntax.InfixExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.InfixExpression+infixExpressionWithRhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixExpression"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.InfixType+infixType :: Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.InfixType+infixType lhs operator rhs =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Typed.unTypedTerm lhs)},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm operator)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm rhs)}]}))+-- | DSL accessor for the lhs field of hydra.haskell.syntax.InfixType+infixTypeLhs :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Type+infixTypeLhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the operator field of hydra.haskell.syntax.InfixType+infixTypeOperator :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Operator+infixTypeOperator x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the rhs field of hydra.haskell.syntax.InfixType+infixTypeRhs :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Type+infixTypeRhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the lhs field of hydra.haskell.syntax.InfixType+infixTypeWithLhs :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.InfixType+infixTypeWithLhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the operator field of hydra.haskell.syntax.InfixType+infixTypeWithOperator :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.InfixType+infixTypeWithOperator original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the rhs field of hydra.haskell.syntax.InfixType+infixTypeWithRhs :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.InfixType+infixTypeWithRhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "lhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.InfixType"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.LambdaExpression+lambdaExpression :: Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.LambdaExpression+lambdaExpression bindings inner =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Typed.unTypedTerm bindings)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)}]}))+-- | DSL accessor for the bindings field of hydra.haskell.syntax.LambdaExpression+lambdaExpressionBindings :: Typed.TypedTerm Syntax.LambdaExpression -> Typed.TypedTerm [Syntax.Pattern]+lambdaExpressionBindings x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.projectionFieldName = (Core.Name "bindings")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.LambdaExpression+lambdaExpressionInner :: Typed.TypedTerm Syntax.LambdaExpression -> Typed.TypedTerm Syntax.Expression+lambdaExpressionInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the bindings field of hydra.haskell.syntax.LambdaExpression+lambdaExpressionWithBindings :: Typed.TypedTerm Syntax.LambdaExpression -> Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.LambdaExpression+lambdaExpressionWithBindings original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the inner field of hydra.haskell.syntax.LambdaExpression+lambdaExpressionWithInner :: Typed.TypedTerm Syntax.LambdaExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.LambdaExpression+lambdaExpressionWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LambdaExpression"),+ Core.projectionFieldName = (Core.Name "bindings")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.LetExpression+letExpression :: Typed.TypedTerm [Syntax.LocalBinding] -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.LetExpression+letExpression bindings inner =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Typed.unTypedTerm bindings)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)}]}))+-- | DSL accessor for the bindings field of hydra.haskell.syntax.LetExpression+letExpressionBindings :: Typed.TypedTerm Syntax.LetExpression -> Typed.TypedTerm [Syntax.LocalBinding]+letExpressionBindings x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.projectionFieldName = (Core.Name "bindings")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.LetExpression+letExpressionInner :: Typed.TypedTerm Syntax.LetExpression -> Typed.TypedTerm Syntax.Expression+letExpressionInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the bindings field of hydra.haskell.syntax.LetExpression+letExpressionWithBindings :: Typed.TypedTerm Syntax.LetExpression -> Typed.TypedTerm [Syntax.LocalBinding] -> Typed.TypedTerm Syntax.LetExpression+letExpressionWithBindings original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the inner field of hydra.haskell.syntax.LetExpression+letExpressionWithInner :: Typed.TypedTerm Syntax.LetExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.LetExpression+letExpressionWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.LetExpression"),+ Core.projectionFieldName = (Core.Name "bindings")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the char variant of hydra.haskell.syntax.Literal+literalChar :: Typed.TypedTerm Int -> Typed.TypedTerm Syntax.Literal+literalChar x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "char"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the double variant of hydra.haskell.syntax.Literal+literalDouble :: Typed.TypedTerm Double -> Typed.TypedTerm Syntax.Literal+literalDouble x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "double"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the float variant of hydra.haskell.syntax.Literal+literalFloat :: Typed.TypedTerm Float -> Typed.TypedTerm Syntax.Literal+literalFloat x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the int variant of hydra.haskell.syntax.Literal+literalInt :: Typed.TypedTerm Int -> Typed.TypedTerm Syntax.Literal+literalInt x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the integer variant of hydra.haskell.syntax.Literal+literalInteger :: Typed.TypedTerm Integer -> Typed.TypedTerm Syntax.Literal+literalInteger x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the string variant of hydra.haskell.syntax.Literal+literalString :: Typed.TypedTerm String -> Typed.TypedTerm Syntax.Literal+literalString x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the signature variant of hydra.haskell.syntax.LocalBinding+localBindingSignature :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.LocalBinding+localBindingSignature x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.LocalBinding"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "signature"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the value variant of hydra.haskell.syntax.LocalBinding+localBindingValue :: Typed.TypedTerm Syntax.ValueBinding -> Typed.TypedTerm Syntax.LocalBinding+localBindingValue x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.LocalBinding"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.haskell.syntax.LocalBindings wrapper+localBindings :: Typed.TypedTerm [Syntax.LocalBinding] -> Typed.TypedTerm Syntax.LocalBindings+localBindings x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.LocalBindings"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.Module+module_ :: Typed.TypedTerm (Maybe Syntax.ModuleHead) -> Typed.TypedTerm [Syntax.Import] -> Typed.TypedTerm [Syntax.Declaration] -> Typed.TypedTerm Syntax.Module+module_ head imports declarations =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Typed.unTypedTerm head)},+ Core.Field {+ Core.fieldName = (Core.Name "imports"),+ Core.fieldTerm = (Typed.unTypedTerm imports)},+ Core.Field {+ Core.fieldName = (Core.Name "declarations"),+ Core.fieldTerm = (Typed.unTypedTerm declarations)}]}))+-- | DSL accessor for the declarations field of hydra.haskell.syntax.Module+moduleDeclarations :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm [Syntax.Declaration]+moduleDeclarations x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "declarations")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the head field of hydra.haskell.syntax.Module+moduleHead :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm (Maybe Syntax.ModuleHead)+moduleHead x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.ModuleHead+moduleHead2 :: Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm [Syntax.Export] -> Typed.TypedTerm Syntax.ModuleHead+moduleHead2 comments name exports =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "exports"),+ Core.fieldTerm = (Typed.unTypedTerm exports)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.ModuleHead+moduleHeadComments :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm (Maybe String)+moduleHeadComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the exports field of hydra.haskell.syntax.ModuleHead+moduleHeadExports :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm [Syntax.Export]+moduleHeadExports x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "exports")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.ModuleHead+moduleHeadName :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm Syntax.ModuleName+moduleHeadName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.ModuleHead+moduleHeadWithComments :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.ModuleHead+moduleHeadWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "exports"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "exports")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the exports field of hydra.haskell.syntax.ModuleHead+moduleHeadWithExports :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm [Syntax.Export] -> Typed.TypedTerm Syntax.ModuleHead+moduleHeadWithExports original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "exports"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.ModuleHead+moduleHeadWithName :: Typed.TypedTerm Syntax.ModuleHead -> Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm Syntax.ModuleHead+moduleHeadWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "exports"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.ModuleHead"),+ Core.projectionFieldName = (Core.Name "exports")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the imports field of hydra.haskell.syntax.Module+moduleImports :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm [Syntax.Import]+moduleImports x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "imports")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for the hydra.haskell.syntax.ModuleName wrapper+moduleName :: Typed.TypedTerm String -> Typed.TypedTerm Syntax.ModuleName+moduleName x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.ModuleName"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL updater for the declarations field of hydra.haskell.syntax.Module+moduleWithDeclarations :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm [Syntax.Declaration] -> Typed.TypedTerm Syntax.Module+moduleWithDeclarations original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "imports"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "imports")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "declarations"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the head field of hydra.haskell.syntax.Module+moduleWithHead :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm (Maybe Syntax.ModuleHead) -> Typed.TypedTerm Syntax.Module+moduleWithHead original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "imports"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "imports")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "declarations"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "declarations")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the imports field of hydra.haskell.syntax.Module+moduleWithImports :: Typed.TypedTerm Syntax.Module -> Typed.TypedTerm [Syntax.Import] -> Typed.TypedTerm Syntax.Module+moduleWithImports original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "head")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "imports"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "declarations"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.Module"),+ Core.projectionFieldName = (Core.Name "declarations")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the implicit variant of hydra.haskell.syntax.Name+nameImplicit :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.Name+nameImplicit x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Name"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "implicit"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the normal variant of hydra.haskell.syntax.Name+nameNormal :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.Name+nameNormal x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Name"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "normal"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.haskell.syntax.NamePart wrapper+namePart :: Typed.TypedTerm String -> Typed.TypedTerm Syntax.NamePart+namePart x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.NamePart"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.NamedImportExport+namedImportExport :: Typed.TypedTerm (Maybe Syntax.ImportModifier) -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm (Maybe Syntax.ImportExportSubspec) -> Typed.TypedTerm Syntax.NamedImportExport+namedImportExport modifier name subspec =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modifier"),+ Core.fieldTerm = (Typed.unTypedTerm modifier)},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "subspec"),+ Core.fieldTerm = (Typed.unTypedTerm subspec)}]}))+-- | DSL accessor for the modifier field of hydra.haskell.syntax.NamedImportExport+namedImportExportModifier :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm (Maybe Syntax.ImportModifier)+namedImportExportModifier x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "modifier")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.NamedImportExport+namedImportExportName :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm Syntax.Name+namedImportExportName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the subspec field of hydra.haskell.syntax.NamedImportExport+namedImportExportSubspec :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm (Maybe Syntax.ImportExportSubspec)+namedImportExportSubspec x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "subspec")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the modifier field of hydra.haskell.syntax.NamedImportExport+namedImportExportWithModifier :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm (Maybe Syntax.ImportModifier) -> Typed.TypedTerm Syntax.NamedImportExport+namedImportExportWithModifier original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modifier"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "subspec"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "subspec")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.NamedImportExport+namedImportExportWithName :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.NamedImportExport+namedImportExportWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modifier"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "modifier")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "subspec"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "subspec")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the subspec field of hydra.haskell.syntax.NamedImportExport+namedImportExportWithSubspec :: Typed.TypedTerm Syntax.NamedImportExport -> Typed.TypedTerm (Maybe Syntax.ImportExportSubspec) -> Typed.TypedTerm Syntax.NamedImportExport+namedImportExportWithSubspec original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modifier"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "modifier")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.NamedImportExport"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "subspec"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the backtick variant of hydra.haskell.syntax.Operator+operatorBacktick :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.Operator+operatorBacktick x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Operator"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "backtick"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the normal variant of hydra.haskell.syntax.Operator+operatorNormal :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.Operator+operatorNormal x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Operator"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "normal"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the application variant of hydra.haskell.syntax.Pattern+patternApplication :: Typed.TypedTerm Syntax.ApplicationPattern -> Typed.TypedTerm Syntax.Pattern+patternApplication x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the as variant of hydra.haskell.syntax.Pattern+patternAs :: Typed.TypedTerm Syntax.AsPattern -> Typed.TypedTerm Syntax.Pattern+patternAs x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "as"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.haskell.syntax.PatternField+patternField :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.PatternField+patternField name pattern =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm pattern)}]}))+-- | DSL accessor for the name field of hydra.haskell.syntax.PatternField+patternFieldName :: Typed.TypedTerm Syntax.PatternField -> Typed.TypedTerm Syntax.Name+patternFieldName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pattern field of hydra.haskell.syntax.PatternField+patternFieldPattern :: Typed.TypedTerm Syntax.PatternField -> Typed.TypedTerm Syntax.Pattern+patternFieldPattern x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.haskell.syntax.PatternField+patternFieldWithName :: Typed.TypedTerm Syntax.PatternField -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.PatternField+patternFieldWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the pattern field of hydra.haskell.syntax.PatternField+patternFieldWithPattern :: Typed.TypedTerm Syntax.PatternField -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.PatternField+patternFieldWithPattern original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PatternField"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the list variant of hydra.haskell.syntax.Pattern+patternList :: Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.Pattern+patternList x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the literal variant of hydra.haskell.syntax.Pattern+patternLiteral :: Typed.TypedTerm Syntax.Literal -> Typed.TypedTerm Syntax.Pattern+patternLiteral x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the name variant of hydra.haskell.syntax.Pattern+patternName :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Pattern+patternName x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the record variant of hydra.haskell.syntax.Pattern+patternRecord :: Typed.TypedTerm Syntax.RecordPattern -> Typed.TypedTerm Syntax.Pattern+patternRecord x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the tuple variant of hydra.haskell.syntax.Pattern+patternTuple :: Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.Pattern+patternTuple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "tuple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the typed variant of hydra.haskell.syntax.Pattern+patternTyped :: Typed.TypedTerm Syntax.TypedPattern -> Typed.TypedTerm Syntax.Pattern+patternTyped x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typed"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the wildcard variant of hydra.haskell.syntax.Pattern+patternWildcard :: Typed.TypedTerm Syntax.Pattern+patternWildcard =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wildcard"),+ Core.fieldTerm = Core.TermUnit}}))+-- | DSL constructor for hydra.haskell.syntax.PositionalConstructor+positionalConstructor :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.Type] -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.PositionalConstructor+positionalConstructor name fields comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm fields)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorComments :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm (Maybe String)+positionalConstructorComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the fields field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorFields :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm [Syntax.Type]+positionalConstructorFields x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorName :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm Syntax.Name+positionalConstructorName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorWithComments :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.PositionalConstructor+positionalConstructorWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the fields field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorWithFields :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm [Syntax.Type] -> Typed.TypedTerm Syntax.PositionalConstructor+positionalConstructorWithFields original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.PositionalConstructor+positionalConstructorWithName :: Typed.TypedTerm Syntax.PositionalConstructor -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.PositionalConstructor+positionalConstructorWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.PositionalConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.QualifiedName+qualifiedName :: Typed.TypedTerm [Syntax.NamePart] -> Typed.TypedTerm Syntax.NamePart -> Typed.TypedTerm Syntax.QualifiedName+qualifiedName qualifiers unqualified =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualifiers"),+ Core.fieldTerm = (Typed.unTypedTerm qualifiers)},+ Core.Field {+ Core.fieldName = (Core.Name "unqualified"),+ Core.fieldTerm = (Typed.unTypedTerm unqualified)}]}))+-- | DSL accessor for the qualifiers field of hydra.haskell.syntax.QualifiedName+qualifiedNameQualifiers :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm [Syntax.NamePart]+qualifiedNameQualifiers x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.projectionFieldName = (Core.Name "qualifiers")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the unqualified field of hydra.haskell.syntax.QualifiedName+qualifiedNameUnqualified :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.NamePart+qualifiedNameUnqualified x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.projectionFieldName = (Core.Name "unqualified")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the qualifiers field of hydra.haskell.syntax.QualifiedName+qualifiedNameWithQualifiers :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm [Syntax.NamePart] -> Typed.TypedTerm Syntax.QualifiedName+qualifiedNameWithQualifiers original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualifiers"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "unqualified"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.projectionFieldName = (Core.Name "unqualified")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the unqualified field of hydra.haskell.syntax.QualifiedName+qualifiedNameWithUnqualified :: Typed.TypedTerm Syntax.QualifiedName -> Typed.TypedTerm Syntax.NamePart -> Typed.TypedTerm Syntax.QualifiedName+qualifiedNameWithUnqualified original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "qualifiers"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.QualifiedName"),+ Core.projectionFieldName = (Core.Name "qualifiers")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "unqualified"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.RecordConstructor+recordConstructor :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.Field] -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.RecordConstructor+recordConstructor name fields comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm fields)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.RecordConstructor+recordConstructorComments :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm (Maybe String)+recordConstructorComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the fields field of hydra.haskell.syntax.RecordConstructor+recordConstructorFields :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm [Syntax.Field]+recordConstructorFields x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.RecordConstructor+recordConstructorName :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm Syntax.Name+recordConstructorName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.RecordConstructor+recordConstructorWithComments :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.RecordConstructor+recordConstructorWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the fields field of hydra.haskell.syntax.RecordConstructor+recordConstructorWithFields :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm [Syntax.Field] -> Typed.TypedTerm Syntax.RecordConstructor+recordConstructorWithFields original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.RecordConstructor+recordConstructorWithName :: Typed.TypedTerm Syntax.RecordConstructor -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.RecordConstructor+recordConstructorWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordConstructor"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.RecordExpression+recordExpression :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.FieldUpdate] -> Typed.TypedTerm Syntax.RecordExpression+recordExpression name fields =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm fields)}]}))+-- | DSL accessor for the fields field of hydra.haskell.syntax.RecordExpression+recordExpressionFields :: Typed.TypedTerm Syntax.RecordExpression -> Typed.TypedTerm [Syntax.FieldUpdate]+recordExpressionFields x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.RecordExpression+recordExpressionName :: Typed.TypedTerm Syntax.RecordExpression -> Typed.TypedTerm Syntax.Name+recordExpressionName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the fields field of hydra.haskell.syntax.RecordExpression+recordExpressionWithFields :: Typed.TypedTerm Syntax.RecordExpression -> Typed.TypedTerm [Syntax.FieldUpdate] -> Typed.TypedTerm Syntax.RecordExpression+recordExpressionWithFields original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.RecordExpression+recordExpressionWithName :: Typed.TypedTerm Syntax.RecordExpression -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.RecordExpression+recordExpressionWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordExpression"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.RecordPattern+recordPattern :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm [Syntax.PatternField] -> Typed.TypedTerm Syntax.RecordPattern+recordPattern name fields =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm fields)}]}))+-- | DSL accessor for the fields field of hydra.haskell.syntax.RecordPattern+recordPatternFields :: Typed.TypedTerm Syntax.RecordPattern -> Typed.TypedTerm [Syntax.PatternField]+recordPatternFields x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.RecordPattern+recordPatternName :: Typed.TypedTerm Syntax.RecordPattern -> Typed.TypedTerm Syntax.Name+recordPatternName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the fields field of hydra.haskell.syntax.RecordPattern+recordPatternWithFields :: Typed.TypedTerm Syntax.RecordPattern -> Typed.TypedTerm [Syntax.PatternField] -> Typed.TypedTerm Syntax.RecordPattern+recordPatternWithFields original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.RecordPattern+recordPatternWithName :: Typed.TypedTerm Syntax.RecordPattern -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.RecordPattern+recordPatternWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordPattern"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.RecordUpdateExpression+recordUpdateExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm [Syntax.FieldUpdate] -> Typed.TypedTerm Syntax.RecordUpdateExpression+recordUpdateExpression inner fields =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm fields)}]}))+-- | DSL accessor for the fields field of hydra.haskell.syntax.RecordUpdateExpression+recordUpdateExpressionFields :: Typed.TypedTerm Syntax.RecordUpdateExpression -> Typed.TypedTerm [Syntax.FieldUpdate]+recordUpdateExpressionFields x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.RecordUpdateExpression+recordUpdateExpressionInner :: Typed.TypedTerm Syntax.RecordUpdateExpression -> Typed.TypedTerm Syntax.Expression+recordUpdateExpressionInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the fields field of hydra.haskell.syntax.RecordUpdateExpression+recordUpdateExpressionWithFields :: Typed.TypedTerm Syntax.RecordUpdateExpression -> Typed.TypedTerm [Syntax.FieldUpdate] -> Typed.TypedTerm Syntax.RecordUpdateExpression+recordUpdateExpressionWithFields original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the inner field of hydra.haskell.syntax.RecordUpdateExpression+recordUpdateExpressionWithInner :: Typed.TypedTerm Syntax.RecordUpdateExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.RecordUpdateExpression+recordUpdateExpressionWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.RecordUpdateExpression"),+ Core.projectionFieldName = (Core.Name "fields")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for the hydra.haskell.syntax.RightHandSide wrapper+rightHandSide :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.RightHandSide+rightHandSide x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.RightHandSide"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.haskell.syntax.SectionExpression+sectionExpression :: Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.SectionExpression+sectionExpression operator expression =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm operator)},+ Core.Field {+ Core.fieldName = (Core.Name "expression"),+ Core.fieldTerm = (Typed.unTypedTerm expression)}]}))+-- | DSL accessor for the expression field of hydra.haskell.syntax.SectionExpression+sectionExpressionExpression :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Expression+sectionExpressionExpression x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.projectionFieldName = (Core.Name "expression")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the operator field of hydra.haskell.syntax.SectionExpression+sectionExpressionOperator :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Operator+sectionExpressionOperator x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the expression field of hydra.haskell.syntax.SectionExpression+sectionExpressionWithExpression :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.SectionExpression+sectionExpressionWithExpression original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.projectionFieldName = (Core.Name "operator")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "expression"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the operator field of hydra.haskell.syntax.SectionExpression+sectionExpressionWithOperator :: Typed.TypedTerm Syntax.SectionExpression -> Typed.TypedTerm Syntax.Operator -> Typed.TypedTerm Syntax.SectionExpression+sectionExpressionWithOperator original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "operator"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "expression"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SectionExpression"),+ Core.projectionFieldName = (Core.Name "expression")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.SimpleValueBinding+simpleValueBinding :: Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.RightHandSide -> Typed.TypedTerm (Maybe Syntax.LocalBindings) -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.SimpleValueBinding+simpleValueBinding pattern rhs localBindings comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm pattern)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm rhs)},+ Core.Field {+ Core.fieldName = (Core.Name "localBindings"),+ Core.fieldTerm = (Typed.unTypedTerm localBindings)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingComments :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm (Maybe String)+simpleValueBindingComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the localBindings field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingLocalBindings :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm (Maybe Syntax.LocalBindings)+simpleValueBindingLocalBindings x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "localBindings")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pattern field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingPattern :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm Syntax.Pattern+simpleValueBindingPattern x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the rhs field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingRhs :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm Syntax.RightHandSide+simpleValueBindingRhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingWithComments :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.SimpleValueBinding+simpleValueBindingWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "localBindings"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "localBindings")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the localBindings field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingWithLocalBindings :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm (Maybe Syntax.LocalBindings) -> Typed.TypedTerm Syntax.SimpleValueBinding+simpleValueBindingWithLocalBindings original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "localBindings"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the pattern field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingWithPattern :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.SimpleValueBinding+simpleValueBindingWithPattern original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "rhs")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "localBindings"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "localBindings")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the rhs field of hydra.haskell.syntax.SimpleValueBinding+simpleValueBindingWithRhs :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm Syntax.RightHandSide -> Typed.TypedTerm Syntax.SimpleValueBinding+simpleValueBindingWithRhs original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "pattern")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "localBindings"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "localBindings")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.SimpleValueBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for the hydra.haskell.syntax.Statement wrapper+statement :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Statement+statement x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.Statement"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the application variant of hydra.haskell.syntax.Type+typeApplication :: Typed.TypedTerm Syntax.ApplicationType -> Typed.TypedTerm Syntax.Type+typeApplication x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the ctx variant of hydra.haskell.syntax.Type+typeCtx :: Typed.TypedTerm Syntax.ConstrainedType -> Typed.TypedTerm Syntax.Type+typeCtx x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ctx"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the function variant of hydra.haskell.syntax.Type+typeFunction :: Typed.TypedTerm Syntax.FunctionType -> Typed.TypedTerm Syntax.Type+typeFunction x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the infix variant of hydra.haskell.syntax.Type+typeInfix :: Typed.TypedTerm Syntax.InfixType -> Typed.TypedTerm Syntax.Type+typeInfix x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "infix"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the list variant of hydra.haskell.syntax.Type+typeList :: Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Type+typeList x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.haskell.syntax.TypeSignature+typeSignature :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeSignature+typeSignature name type_ =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the name field of hydra.haskell.syntax.TypeSignature+typeSignatureName :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.Name+typeSignatureName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.TypeSignature+typeSignatureType :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.Type+typeSignatureType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.haskell.syntax.TypeSignature+typeSignatureWithName :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.TypeSignature+typeSignatureWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.TypeSignature+typeSignatureWithType :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeSignature+typeSignatureWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSignature"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclaration :: Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.TypeSynonymDeclaration+typeSynonymDeclaration name type_ comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm name)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationComments :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm (Maybe String)+typeSynonymDeclarationComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationName :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm Syntax.DeclarationHead+typeSynonymDeclarationName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationType :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm Syntax.Type+typeSynonymDeclarationType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithComments :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithName :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm Syntax.DeclarationHead -> Typed.TypedTerm Syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithName original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithType :: Typed.TypedTerm Syntax.TypeSynonymDeclaration -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeSynonymDeclaration+typeSynonymDeclarationWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "name")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the tuple variant of hydra.haskell.syntax.Type+typeTuple :: Typed.TypedTerm [Syntax.Type] -> Typed.TypedTerm Syntax.Type+typeTuple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "tuple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the variable variant of hydra.haskell.syntax.Type+typeVariable :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Type+typeVariable x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.haskell.syntax.TypedBinding+typedBinding :: Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.ValueBinding -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.TypedBinding+typedBinding typeSignature valueBinding comments =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeSignature"),+ Core.fieldTerm = (Typed.unTypedTerm typeSignature)},+ Core.Field {+ Core.fieldName = (Core.Name "valueBinding"),+ Core.fieldTerm = (Typed.unTypedTerm valueBinding)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm comments)}]}))+-- | DSL accessor for the comments field of hydra.haskell.syntax.TypedBinding+typedBindingComments :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm (Maybe String)+typedBindingComments x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the typeSignature field of hydra.haskell.syntax.TypedBinding+typedBindingTypeSignature :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm Syntax.TypeSignature+typedBindingTypeSignature x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "typeSignature")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the valueBinding field of hydra.haskell.syntax.TypedBinding+typedBindingValueBinding :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm Syntax.ValueBinding+typedBindingValueBinding x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "valueBinding")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the comments field of hydra.haskell.syntax.TypedBinding+typedBindingWithComments :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.TypedBinding+typedBindingWithComments original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeSignature"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "typeSignature")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "valueBinding"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "valueBinding")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the typeSignature field of hydra.haskell.syntax.TypedBinding+typedBindingWithTypeSignature :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm Syntax.TypeSignature -> Typed.TypedTerm Syntax.TypedBinding+typedBindingWithTypeSignature original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeSignature"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "valueBinding"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "valueBinding")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the valueBinding field of hydra.haskell.syntax.TypedBinding+typedBindingWithValueBinding :: Typed.TypedTerm Syntax.TypedBinding -> Typed.TypedTerm Syntax.ValueBinding -> Typed.TypedTerm Syntax.TypedBinding+typedBindingWithValueBinding original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeSignature"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "typeSignature")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "valueBinding"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "comments"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedBinding"),+ Core.projectionFieldName = (Core.Name "comments")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.haskell.syntax.TypedExpression+typedExpression :: Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypedExpression+typedExpression inner type_ =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.TypedExpression+typedExpressionInner :: Typed.TypedTerm Syntax.TypedExpression -> Typed.TypedTerm Syntax.Expression+typedExpressionInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.TypedExpression+typedExpressionType :: Typed.TypedTerm Syntax.TypedExpression -> Typed.TypedTerm Syntax.Type+typedExpressionType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the inner field of hydra.haskell.syntax.TypedExpression+typedExpressionWithInner :: Typed.TypedTerm Syntax.TypedExpression -> Typed.TypedTerm Syntax.Expression -> Typed.TypedTerm Syntax.TypedExpression+typedExpressionWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.TypedExpression+typedExpressionWithType :: Typed.TypedTerm Syntax.TypedExpression -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypedExpression+typedExpressionWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedExpression"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.haskell.syntax.TypedPattern+typedPattern :: Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypedPattern+typedPattern inner type_ =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm inner)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the inner field of hydra.haskell.syntax.TypedPattern+typedPatternInner :: Typed.TypedTerm Syntax.TypedPattern -> Typed.TypedTerm Syntax.Pattern+typedPatternInner x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.haskell.syntax.TypedPattern+typedPatternType :: Typed.TypedTerm Syntax.TypedPattern -> Typed.TypedTerm Syntax.Type+typedPatternType x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the inner field of hydra.haskell.syntax.TypedPattern+typedPatternWithInner :: Typed.TypedTerm Syntax.TypedPattern -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.TypedPattern+typedPatternWithInner original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.projectionFieldName = (Core.Name "type")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.haskell.syntax.TypedPattern+typedPatternWithType :: Typed.TypedTerm Syntax.TypedPattern -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypedPattern+typedPatternWithType original newVal =+ Typed.TypedTerm (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "inner"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermProject (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.haskell.syntax.TypedPattern"),+ Core.projectionFieldName = (Core.Name "inner")})),+ Core.applicationArgument = (Typed.unTypedTerm original)}))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL accessor for the body of hydra.haskell.syntax.CaseRhs+unCaseRhs :: Typed.TypedTerm Syntax.CaseRhs -> Typed.TypedTerm Syntax.Expression+unCaseRhs x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.CaseRhs")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.DerivingClause+unDerivingClause :: Typed.TypedTerm Syntax.DerivingClause -> Typed.TypedTerm [Syntax.Name]+unDerivingClause x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.DerivingClause")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.LocalBindings+unLocalBindings :: Typed.TypedTerm Syntax.LocalBindings -> Typed.TypedTerm [Syntax.LocalBinding]+unLocalBindings x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.LocalBindings")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.ModuleName+unModuleName :: Typed.TypedTerm Syntax.ModuleName -> Typed.TypedTerm String+unModuleName x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.ModuleName")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.NamePart+unNamePart :: Typed.TypedTerm Syntax.NamePart -> Typed.TypedTerm String+unNamePart x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.NamePart")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.RightHandSide+unRightHandSide :: Typed.TypedTerm Syntax.RightHandSide -> Typed.TypedTerm Syntax.Expression+unRightHandSide x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.RightHandSide")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.Statement+unStatement :: Typed.TypedTerm Syntax.Statement -> Typed.TypedTerm Syntax.Expression+unStatement x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.Statement")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.haskell.syntax.Variable+unVariable :: Typed.TypedTerm Syntax.Variable -> Typed.TypedTerm Syntax.Name+unVariable x =+ Typed.TypedTerm (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.haskell.syntax.Variable")),+ Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the simple variant of hydra.haskell.syntax.ValueBinding+valueBindingSimple :: Typed.TypedTerm Syntax.SimpleValueBinding -> Typed.TypedTerm Syntax.ValueBinding+valueBindingSimple x =+ Typed.TypedTerm (Core.TermInject (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.haskell.syntax.ValueBinding"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "simple"),+ Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.haskell.syntax.Variable wrapper+variable :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Variable+variable x =+ Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.haskell.syntax.Variable"),+ Core.wrappedTermBody = (Typed.unTypedTerm x)}))
+ src/main/haskell/Hydra/Haskell/Coder.hs view
@@ -0,0 +1,852 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Functions for encoding Hydra modules as Haskell modules++module Hydra.Haskell.Coder where+import qualified Hydra.Adapt as Adapt+import qualified Hydra.Analysis as Analysis+import qualified Hydra.Annotations as Annotations+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Constants as Constants+import qualified Hydra.Core as Core+import qualified Hydra.Dependencies as Dependencies+import qualified Hydra.Encode.Core as EncodeCore+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Haskell.Environment as Environment+import qualified Hydra.Haskell.Language as Language+import qualified Hydra.Haskell.Serde as Serde+import qualified Hydra.Haskell.Syntax as Syntax+import qualified Hydra.Haskell.Utils as Utils+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Haskell.Lib.Eithers as Eithers+import qualified Hydra.Haskell.Lib.Equality as Equality+import qualified Hydra.Haskell.Lib.Lists as Lists+import qualified Hydra.Haskell.Lib.Literals as Literals+import qualified Hydra.Haskell.Lib.Logic as Logic+import qualified Hydra.Haskell.Lib.Maps as Maps+import qualified Hydra.Haskell.Lib.Math as Math+import qualified Hydra.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Haskell.Lib.Sets as Sets+import qualified Hydra.Haskell.Lib.Strings as Strings+import qualified Hydra.Names as Names+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Predicates as Predicates+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Resolution as Resolution+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Scoping as Scoping+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Show.Core as ShowCore+import qualified Hydra.Show.Errors as ShowErrors+import qualified Hydra.Strip as Strip+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variables as Variables+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Map as M+import qualified Data.Set as S+-- | Adapt a Hydra type to Haskell's type system and encode it+adaptTypeToHaskellAndEncode :: Util.ModuleNames Syntax.ModuleName -> Core.Type -> t0 -> t1 -> Either Errors.Error Syntax.Type+adaptTypeToHaskellAndEncode namespaces typ cx g =++ let enc = \t -> encodeType namespaces t cx g+ in case (Strip.deannotateType typ) of+ Core.TypeVariable _ -> enc typ+ _ -> Eithers.bind (Adapt.adaptTypeForLanguage Language.haskellLanguage typ) (\adaptedType -> enc adaptedType)+-- | 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),+ "_",+ (Core.unName fname)]+-- | Generate a constant name for a type (e.g., '_TypeName')+constantForTypeName :: Core.Name -> String+constantForTypeName tname = Strings.cat2 "_" (Names.localNameOf tname)+-- | Construct a Haskell module from a Hydra module and its definitions+constructModule :: Util.ModuleNames Syntax.ModuleName -> Packaging.Module -> [Packaging.Definition] -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Module+constructModule namespaces mod defs cx g =++ let hRaw = \namespace -> Packaging.unModuleName namespace+ h =+ \namespace ->+ let raw = Packaging.unModuleName namespace+ parts = Strings.splitOn "." raw+ in (Logic.ifElse (Logic.and (Equality.equal (Lists.length parts) 3) (Equality.equal (Lists.take 2 parts) [+ "hydra",+ "lib"])) (Strings.cat2 "hydra.haskell.lib." (Strings.intercalate "." (Lists.drop 2 parts))) raw)+ createDeclarations =+ \def -> case def of+ Packaging.DefinitionType v0 ->+ let name = Packaging.typeDefinitionName v0+ typ = Core.typeSchemeBody (Packaging.typeDefinitionBody v0)+ in (toTypeDeclarationsFrom namespaces name typ cx g)+ Packaging.DefinitionTerm v0 -> Eithers.bind (toDataDeclaration namespaces v0 cx g) (\d -> Right [+ d])+ importName =+ \name -> Syntax.ModuleName (Strings.intercalate "." (Lists.map Formatting.capitalize (Strings.splitOn "." name)))+ imports = Lists.concat2 domainImports standardImports+ domainImports =++ let toImport =+ \pair ->+ let namespace = Pairs.first pair+ alias = Pairs.second pair+ name = h namespace+ in Syntax.Import {+ Syntax.importQualified = True,+ Syntax.importModule = (importName name),+ Syntax.importAs = (Just alias),+ Syntax.importSpec = Nothing}+ in (Lists.map toImport (Maps.toList (Util.moduleNamesMapping namespaces)))+ meta = gatherMetadata defs+ condImport = \flag -> \triple -> Logic.ifElse flag [+ triple] []+ standardImports =++ let toImport =+ \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 (Syntax.ImportSpecHiding (Lists.map (\n -> Syntax.NamedImportExport {+ Syntax.namedImportExportModifier = Nothing,+ Syntax.namedImportExportName = (Utils.simpleName n),+ Syntax.namedImportExportSubspec = Nothing}) hidden)))+ in Syntax.Import {+ Syntax.importQualified = (Optionals.isGiven malias),+ Syntax.importModule = (Syntax.ModuleName name),+ Syntax.importAs = (Optionals.map (\x -> Syntax.ModuleName x) malias),+ Syntax.importSpec = spec}+ in (Lists.map toImport (Lists.concat [+ [+ (+ ("Prelude", Nothing),+ [+ "Enum",+ "Ordering",+ "decodeFloat",+ "encodeFloat",+ "fail",+ "map",+ "pure",+ "sum"])],+ [+ (("Data.Scientific", (Just "Sci")), [])],+ (condImport (Environment.haskellModuleMetadataUsesByteString meta) (("Data.ByteString", (Just "B")), [])),+ (condImport (Environment.haskellModuleMetadataUsesInt meta) (("Data.Int", (Just "I")), [])),+ (condImport (Environment.haskellModuleMetadataUsesMap meta) (("Data.Map", (Just "M")), [])),+ (condImport (Environment.haskellModuleMetadataUsesSet meta) (("Data.Set", (Just "S")), [])),+ (Logic.ifElse (Logic.or (Analysis.moduleContainsBinaryLiterals mod) (Analysis.moduleContainsDecimalLiterals mod)) [+ (("Hydra.Haskell.Lib.Literals", (Just "Literals")), [])] [])]))+ in (Eithers.bind (Eithers.mapList createDeclarations defs) (\declLists ->+ let decls = Lists.concat declLists+ mc = Optionals.bind (Packaging.moduleMetadata mod) (\em -> Packaging.entityMetadataDescription em)+ in (Right (Syntax.Module {+ Syntax.moduleHead = (Just (Syntax.ModuleHead {+ Syntax.moduleHeadComments = mc,+ Syntax.moduleHeadName = (importName (hRaw (Packaging.moduleName mod))),+ Syntax.moduleHeadExports = []})),+ Syntax.moduleImports = imports,+ Syntax.moduleDeclarations = decls}))))+-- | Create an initial empty metadata record with all flags set to false+emptyMetadata :: Environment.HaskellModuleMetadata+emptyMetadata =+ Environment.HaskellModuleMetadata {+ Environment.haskellModuleMetadataUsesByteString = False,+ Environment.haskellModuleMetadataUsesInt = False,+ Environment.haskellModuleMetadataUsesMap = False,+ Environment.haskellModuleMetadataUsesSet = False}+-- | Encode a Hydra case statement as a Haskell case expression with a given scrutinee+encodeCaseExpression :: Int -> Util.ModuleNames Syntax.ModuleName -> Core.CaseStatement -> Syntax.Expression -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Expression+encodeCaseExpression depth namespaces stmt scrutinee cx g =++ let dn = Core.caseStatementTypeName stmt+ def = Core.caseStatementDefault stmt+ fields = Core.caseStatementCases stmt+ toAlt =+ \fieldMap -> \field ->+ let fn = Core.caseAlternativeName field+ fun_ = Core.caseAlternativeHandler field+ v0 = Strings.cat2 "v" (Literals.showInt32 depth)+ raw =+ Core.TermApplication (Core.Application {+ Core.applicationFunction = fun_,+ Core.applicationArgument = (Core.TermVariable (Core.Name v0))})+ rhsTerm = Dependencies.simplifyTerm raw+ v1 = Logic.ifElse (Variables.isFreeVariableInTerm (Core.Name v0) rhsTerm) Constants.ignoredVariable v0+ hname =+ Utils.unionFieldReference (Sets.union (Sets.fromList (Maps.keys (Graph.graphBoundTerms g))) (Sets.fromList (Maps.keys (Graph.graphSchemaTypes g)))) namespaces dn fn+ in (Eithers.bind (Optionals.cases (Maps.lookup fn fieldMap) (Left (Errors.ErrorResolution (Errors.ResolutionErrorNoMatchingField (Errors.NoMatchingFieldError {+ Errors.noMatchingFieldErrorFieldName = fn})))) (\fieldType ->+ let ft = Core.fieldTypeType fieldType+ noArgs = []+ singleArg = [+ Syntax.PatternName (Utils.rawName v1)]+ in case (Strip.deannotateType ft) of+ Core.TypeUnit -> Right noArgs+ _ -> Right singleArg)) (\args ->+ let lhs = Utils.applicationPattern hname args+ in (Eithers.bind (Eithers.map (\x -> Syntax.CaseRhs x) (encodeTerm (Math.add depth 1) namespaces rhsTerm cx g)) (\rhs -> Right (Syntax.Alternative {+ Syntax.alternativePattern = lhs,+ Syntax.alternativeRhs = rhs,+ Syntax.alternativeBinds = Nothing})))))+ in (Eithers.bind (Resolution.requireUnionType cx g dn) (\rt ->+ let toFieldMapEntry = \f -> (Core.fieldTypeName f, f)+ fieldMap = Maps.fromList (Lists.map toFieldMapEntry rt)+ in (Eithers.bind (Eithers.mapList (toAlt fieldMap) fields) (\ecases -> Eithers.bind (Optionals.cases def (Right []) (\d -> Eithers.bind (Eithers.map (\x -> Syntax.CaseRhs x) (encodeTerm depth namespaces d cx g)) (\cs ->+ let lhs = Syntax.PatternName (Utils.rawName Constants.ignoredVariable)+ alt =+ Syntax.Alternative {+ Syntax.alternativePattern = lhs,+ Syntax.alternativeRhs = cs,+ Syntax.alternativeBinds = Nothing}+ in (Right [+ alt])))) (\dcases -> Right (Syntax.ExpressionCase (Syntax.CaseExpression {+ Syntax.caseExpressionCase = scrutinee,+ Syntax.caseExpressionAlternatives = (Lists.concat2 ecases dcases)})))))))+-- | Encode a Hydra lambda as a Haskell expression+encodeLambdaTerm :: Int -> Util.ModuleNames Syntax.ModuleName -> Core.Lambda -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Expression+encodeLambdaTerm depth namespaces lam cx g =++ let v = Core.lambdaParameter lam+ body = Core.lambdaBody lam+ in (Eithers.bind (encodeTerm depth namespaces body cx g) (\hbody -> Right (Utils.hslambda (Utils.elementReference namespaces v) hbody)))+-- | Encode a Hydra literal as a Haskell expression+encodeLiteral :: Core.Literal -> t0 -> Either Errors.Error Syntax.Expression+encodeLiteral l cx =+ case l of+ Core.LiteralBinary v0 -> Right (Utils.hsapp (Utils.hsvar "Literals.stringToBinary") (Utils.hslit (Syntax.LiteralString (Literals.binaryToString v0))))+ Core.LiteralBoolean v0 -> Right (Utils.hsvar (Logic.ifElse v0 "True" "False"))+ Core.LiteralDecimal v0 -> Right (Utils.hsapp (Utils.hsvar "Literals.stringToDecimal") (Utils.hslit (Syntax.LiteralString (Literals.showDecimal v0))))+ Core.LiteralFloat v0 -> case v0 of+ Core.FloatValueFloat32 v1 -> Right (Utils.hslit (Syntax.LiteralFloat v1))+ Core.FloatValueFloat64 v1 -> Right (Utils.hslit (Syntax.LiteralDouble v1))+ Core.LiteralInteger v0 -> case v0 of+ Core.IntegerValueBigint v1 -> Right (Utils.hslit (Syntax.LiteralInteger v1))+ Core.IntegerValueInt8 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.int8ToBigint v1)))+ Core.IntegerValueInt16 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.int16ToBigint v1)))+ Core.IntegerValueInt32 v1 -> Right (Utils.hslit (Syntax.LiteralInt v1))+ Core.IntegerValueInt64 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.int64ToBigint v1)))+ Core.IntegerValueUint8 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.uint8ToBigint v1)))+ Core.IntegerValueUint16 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.uint16ToBigint v1)))+ Core.IntegerValueUint32 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.uint32ToBigint v1)))+ Core.IntegerValueUint64 v1 -> Right (Utils.hslit (Syntax.LiteralInteger (Literals.uint64ToBigint v1)))+ Core.LiteralString v0 -> Right (Utils.hslit (Syntax.LiteralString v0))+ _ -> Left (Errors.ErrorExtraction (Errors.ExtractionErrorUnexpectedShape (Errors.UnexpectedShapeError {+ Errors.unexpectedShapeErrorExpected = "supported literal",+ Errors.unexpectedShapeErrorActual = (ShowCore.literal l)})))+-- | Encode a record projection as a Haskell expression+encodeProjection :: Util.ModuleNames Syntax.ModuleName -> Core.Projection -> Either t0 Syntax.Expression+encodeProjection namespaces proj =++ let dn = Core.projectionTypeName proj+ fname = Core.projectionFieldName proj+ in (Right (Syntax.ExpressionVariable (Utils.recordFieldReference namespaces dn fname)))+-- | Encode a standalone (un-applied) case statement as a Haskell lambda over a case expression+encodeStandaloneCases :: Int -> Util.ModuleNames Syntax.ModuleName -> Core.CaseStatement -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Expression+encodeStandaloneCases depth namespaces stmt cx g =+ Eithers.map (Utils.hslambda (Utils.rawName "x")) (encodeCaseExpression depth namespaces stmt (Utils.hsvar "x") cx g)+-- | Encode a Hydra term as a Haskell expression+encodeTerm :: Int -> Util.ModuleNames Syntax.ModuleName -> Core.Term -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Expression+encodeTerm depth namespaces term cx g =++ let encode = \t -> encodeTerm depth namespaces t cx g+ nonemptyMap =+ \m ->+ let lhs = Utils.hsvar "M.fromList"+ encodePair =+ \pair ->+ let k = Pairs.first pair+ v = Pairs.second pair+ in (Eithers.bind (encode k) (\hk -> Eithers.bind (encode v) (\hv -> Right (Syntax.ExpressionTuple [+ hk,+ hv]))))+ in (Eithers.bind (Eithers.map (\x -> Syntax.ExpressionList x) (Eithers.mapList encodePair (Maps.toList m))) (\rhs -> Right (Utils.hsapp lhs rhs)))+ nonemptySet =+ \s ->+ let lhs = Utils.hsvar "S.fromList"+ in (Eithers.bind (encodeTerm depth namespaces (Core.TermList (Sets.toList s)) cx g) (\rhs -> Right (Utils.hsapp lhs rhs)))+ in case (Strip.deannotateTerm term) of+ Core.TermApplication v0 ->+ let fun = Core.applicationFunction v0+ arg = Core.applicationArgument v0+ deannotatedFun = Strip.deannotateTerm fun+ in case deannotatedFun of+ Core.TermCases v1 -> Eithers.bind (encode arg) (\harg -> encodeCaseExpression depth namespaces v1 harg cx g)+ _ -> Eithers.bind (encode fun) (\hfun -> Eithers.bind (encode arg) (\harg -> Right (Utils.hsapp hfun harg)))+ Core.TermCases v0 -> encodeStandaloneCases depth namespaces v0 cx g+ Core.TermEither v0 -> Eithers.either (\l -> Eithers.bind (encode l) (\hl -> Right (Utils.hsapp (Utils.hsvar "Left") hl))) (\r -> Eithers.bind (encode r) (\hr -> Right (Utils.hsapp (Utils.hsvar "Right") hr))) v0+ Core.TermLambda v0 -> encodeLambdaTerm depth namespaces v0 cx g+ Core.TermProject v0 -> encodeProjection namespaces v0+ Core.TermUnwrap v0 -> encodeUnwrap namespaces v0+ Core.TermLet v0 ->+ let collectBindings =+ \lt ->+ let bs = Core.letBindings lt+ body = Core.letBody lt+ in case (Strip.deannotateTerm body) of+ Core.TermLet v1 ->+ let innerResult = collectBindings v1+ in (Lists.concat2 bs (Pairs.first innerResult), (Pairs.second innerResult))+ _ -> (bs, body)+ collected = collectBindings v0+ allBindings = Pairs.first collected+ finalBody = Pairs.second collected+ encodeBinding =+ \binding ->+ let name = Core.bindingName binding+ term_ = Core.bindingTerm binding+ hname = Utils.simpleName (Core.unName name)+ in (Eithers.bind (encode term_) (\hexpr -> Right (Syntax.LocalBindingValue (Utils.simpleValueBinding hname hexpr Nothing))))+ in (Eithers.bind (Eithers.mapList encodeBinding allBindings) (\hbindings -> Eithers.bind (encode finalBody) (\hinner -> Right (Syntax.ExpressionLet (Syntax.LetExpression {+ Syntax.letExpressionBindings = hbindings,+ Syntax.letExpressionInner = hinner})))))+ Core.TermList v0 -> Eithers.bind (Eithers.mapList encode v0) (\helems -> Right (Syntax.ExpressionList helems))+ Core.TermLiteral v0 -> encodeLiteral v0 cx+ Core.TermMap v0 -> Logic.ifElse (Maps.null v0) (Right (Utils.hsvar "M.empty")) (nonemptyMap v0)+ Core.TermOptional v0 -> Optionals.cases v0 (Right (Utils.hsvar "Nothing")) (\t -> Eithers.bind (encode t) (\ht -> Right (Utils.hsapp (Utils.hsvar "Just") ht)))+ Core.TermPair v0 -> Eithers.bind (encode (Pairs.first v0)) (\f -> Eithers.bind (encode (Pairs.second v0)) (\s -> Right (Syntax.ExpressionTuple [+ f,+ s])))+ Core.TermRecord v0 ->+ let sname = Core.recordTypeName v0+ fields = Core.recordFields v0+ toFieldUpdate =+ \field ->+ let fn = Core.fieldName field+ ft = Core.fieldTerm field+ fieldRef = Utils.recordFieldReference namespaces sname fn+ in (Eithers.bind (encode ft) (\hft -> Right (Syntax.FieldUpdate {+ Syntax.fieldUpdateName = fieldRef,+ Syntax.fieldUpdateValue = hft})))+ typeName = Utils.elementReference namespaces sname+ in (Eithers.bind (Eithers.mapList toFieldUpdate fields) (\updates -> Right (Syntax.ExpressionConstructRecord (Syntax.RecordExpression {+ Syntax.recordExpressionName = typeName,+ Syntax.recordExpressionFields = updates}))))+ Core.TermSet v0 -> Logic.ifElse (Sets.null v0) (Right (Utils.hsvar "S.empty")) (nonemptySet v0)+ Core.TermTypeLambda v0 ->+ let term1 = Core.typeLambdaBody v0+ in (encode term1)+ Core.TermTypeApplication v0 ->+ let term1 = Core.typeApplicationTermBody v0+ in (encode term1)+ Core.TermInject v0 ->+ let sname = Core.injectionTypeName v0+ field = Core.injectionField v0+ fn = Core.fieldName field+ ft = Core.fieldTerm field+ lhs =+ Syntax.ExpressionVariable (Utils.unionFieldReference (Sets.union (Sets.fromList (Maps.keys (Graph.graphBoundTerms g))) (Sets.fromList (Maps.keys (Graph.graphSchemaTypes g)))) namespaces sname fn)+ dflt = Eithers.map (Utils.hsapp lhs) (encode ft)+ in (Eithers.bind (Resolution.requireUnionField cx g sname fn) (\ftyp -> case (Strip.deannotateType ftyp) of+ Core.TypeUnit -> Right lhs+ _ -> dflt))+ Core.TermUnit -> Right (Syntax.ExpressionTuple [])+ Core.TermVariable v0 -> Right (Syntax.ExpressionVariable (Utils.elementReference namespaces v0))+ Core.TermWrap v0 ->+ let tname = Core.wrappedTermTypeName v0+ term_ = Core.wrappedTermBody v0+ lhs = Syntax.ExpressionVariable (Utils.elementReference namespaces tname)+ in (Eithers.bind (encode term_) (\rhs -> Right (Utils.hsapp lhs rhs)))+ _ -> Left (Errors.ErrorExtraction (Errors.ExtractionErrorUnexpectedShape (Errors.UnexpectedShapeError {+ Errors.unexpectedShapeErrorExpected = "supported term",+ Errors.unexpectedShapeErrorActual = (ShowCore.term term)})))+-- | Encode a Hydra type as a Haskell type+encodeType :: Util.ModuleNames Syntax.ModuleName -> Core.Type -> t0 -> t1 -> Either Errors.Error Syntax.Type+encodeType namespaces typ cx g =++ let encode = \t -> encodeType namespaces t cx g+ ref = \name -> Right (Syntax.TypeVariable (Utils.elementReference namespaces name))+ unitTuple = Syntax.TypeTuple []+ in case (Strip.deannotateType typ) of+ Core.TypeApplication v0 ->+ let lhs = Core.applicationTypeFunction v0+ rhs = Core.applicationTypeArgument v0+ in (Eithers.bind (encode lhs) (\hlhs -> Eithers.bind (encode rhs) (\hrhs -> Right (Utils.toTypeApplication [+ hlhs,+ hrhs]))))+ Core.TypeEither v0 ->+ let left_ = Core.eitherTypeLeft v0+ right_ = Core.eitherTypeRight v0+ in (Eithers.bind (encode left_) (\hleft -> Eithers.bind (encode right_) (\hright -> Right (Utils.toTypeApplication [+ Syntax.TypeVariable (Utils.rawName "Either"),+ hleft,+ hright]))))+ Core.TypeFunction v0 ->+ let dom = Core.functionTypeDomain v0+ cod = Core.functionTypeCodomain v0+ in (Eithers.bind (encode dom) (\hdom -> Eithers.bind (encode cod) (\hcod -> Right (Syntax.TypeFunction (Syntax.FunctionType {+ Syntax.functionTypeDomain = hdom,+ Syntax.functionTypeCodomain = hcod})))))+ Core.TypeForall v0 ->+ let v = Core.forallTypeParameter v0+ body = Core.forallTypeBody v0+ in (encode body)+ Core.TypeList v0 -> Eithers.bind (encode v0) (\hlt -> Right (Syntax.TypeList hlt))+ Core.TypeLiteral v0 -> case v0 of+ Core.LiteralTypeBinary -> Right (Syntax.TypeVariable (Utils.rawName "B.ByteString"))+ Core.LiteralTypeBoolean -> Right (Syntax.TypeVariable (Utils.rawName "Bool"))+ Core.LiteralTypeDecimal -> Right (Syntax.TypeVariable (Utils.rawName "Sci.Scientific"))+ Core.LiteralTypeFloat v1 -> case v1 of+ Core.FloatTypeFloat32 -> Right (Syntax.TypeVariable (Utils.rawName "Float"))+ Core.FloatTypeFloat64 -> Right (Syntax.TypeVariable (Utils.rawName "Double"))+ Core.LiteralTypeInteger v1 -> case v1 of+ Core.IntegerTypeBigint -> Right (Syntax.TypeVariable (Utils.rawName "Integer"))+ Core.IntegerTypeInt8 -> Right (Syntax.TypeVariable (Utils.rawName "I.Int8"))+ Core.IntegerTypeInt16 -> Right (Syntax.TypeVariable (Utils.rawName "I.Int16"))+ Core.IntegerTypeInt32 -> Right (Syntax.TypeVariable (Utils.rawName "Int"))+ Core.IntegerTypeInt64 -> Right (Syntax.TypeVariable (Utils.rawName "I.Int64"))+ _ -> Left (Errors.ErrorExtraction (Errors.ExtractionErrorUnexpectedShape (Errors.UnexpectedShapeError {+ Errors.unexpectedShapeErrorExpected = "supported integer type",+ Errors.unexpectedShapeErrorActual = (ShowCore.integerType v1)})))+ Core.LiteralTypeString -> Right (Syntax.TypeVariable (Utils.rawName "String"))+ _ -> Left (Errors.ErrorExtraction (Errors.ExtractionErrorUnexpectedShape (Errors.UnexpectedShapeError {+ Errors.unexpectedShapeErrorExpected = "supported literal type",+ Errors.unexpectedShapeErrorActual = (ShowCore.literalType v0)})))+ Core.TypeMap v0 ->+ let kt = Core.mapTypeKeys v0+ vt = Core.mapTypeValues v0+ in (Eithers.bind (encode kt) (\hkt -> Eithers.bind (encode vt) (\hvt -> Right (Utils.toTypeApplication [+ Syntax.TypeVariable (Utils.rawName "M.Map"),+ hkt,+ hvt]))))+ Core.TypeOptional v0 -> Eithers.bind (encode v0) (\hot -> Right (Utils.toTypeApplication [+ Syntax.TypeVariable (Utils.rawName "Maybe"),+ hot]))+ Core.TypePair v0 -> Eithers.bind (encode (Core.pairTypeFirst v0)) (\f -> Eithers.bind (encode (Core.pairTypeSecond v0)) (\s -> Right (Syntax.TypeTuple [+ f,+ s])))+ Core.TypeRecord _ -> ref (Core.Name "placeholder")+ Core.TypeSet v0 -> Eithers.bind (encode v0) (\hst -> Right (Utils.toTypeApplication [+ Syntax.TypeVariable (Utils.rawName "S.Set"),+ hst]))+ Core.TypeUnion _ -> ref (Core.Name "placeholder")+ Core.TypeUnit -> Right unitTuple+ Core.TypeVariable v0 -> ref v0+ Core.TypeVoid -> Right (Syntax.TypeVariable (Utils.rawName "Void"))+ Core.TypeWrap _ -> ref (Core.Name "placeholder")+ _ -> Left (Errors.ErrorExtraction (Errors.ExtractionErrorUnexpectedShape (Errors.UnexpectedShapeError {+ Errors.unexpectedShapeErrorExpected = "supported type",+ Errors.unexpectedShapeErrorActual = (ShowCore.type_ typ)})))+-- | Encode a Hydra type as a Haskell type with typeclass assertions+encodeTypeWithClassAssertions :: Util.ModuleNames Syntax.ModuleName -> M.Map Core.Name (S.Set Core.Name) -> Core.Type -> t0 -> t1 -> Either Errors.Error Syntax.Type+encodeTypeWithClassAssertions namespaces explicitClasses typ cx g =++ let classes = Maps.union explicitClasses (getImplicitTypeClasses typ)+ implicitClasses = getImplicitTypeClasses typ+ encodeAssertion =+ \pair ->+ let name = Pairs.first pair+ cls = Pairs.second pair+ classLocal = Core.unName cls+ hname =+ Utils.rawName (Logic.ifElse (Equality.equal classLocal "equality") "Eq" (Logic.ifElse (Equality.equal classLocal "ordering") "Ord" (Formatting.capitalize classLocal)))+ htype = Syntax.TypeVariable (Utils.rawName (Core.unName name))+ in (Syntax.ConstraintClass (Syntax.ClassConstraint {+ Syntax.classConstraintName = hname,+ Syntax.classConstraintTypes = [+ htype]}))+ assertPairs = Lists.concat (Lists.map toPairs (Maps.toList classes))+ toPairs =+ \mapEntry ->+ let name = Pairs.first mapEntry+ clsSet = Pairs.second mapEntry+ toPair = \c -> (name, c)+ in (Lists.map toPair (Sets.toList clsSet))+ in (Eithers.bind (adaptTypeToHaskellAndEncode namespaces typ cx g) (\htyp -> Logic.ifElse (Lists.null assertPairs) (Right htyp) (+ let encoded = Lists.map encodeAssertion assertPairs+ hassert =+ Logic.ifElse (Equality.equal (Lists.length encoded) 1) (Optionals.fromOptional (Syntax.ConstraintTuple encoded) (Lists.maybeHead encoded)) (Syntax.ConstraintTuple encoded)+ in (Right (Syntax.TypeCtx (Syntax.ConstrainedType {+ Syntax.constrainedTypeCtx = hassert,+ Syntax.constrainedTypeType = htyp}))))))+-- | Encode an unwrap term as a Haskell expression+encodeUnwrap :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Either t0 Syntax.Expression+encodeUnwrap namespaces name =+ Right (Syntax.ExpressionVariable (Utils.elementReference namespaces (Names.qname (Optionals.fromOptional (Packaging.ModuleName "") (Names.moduleNameOf name)) (Utils.newtypeAccessorName name))))+-- | Extend metadata by analyzing a term for standard import usage (bottom-up step function)+extendMetaForTerm :: Environment.HaskellModuleMetadata -> Core.Term -> Environment.HaskellModuleMetadata+extendMetaForTerm meta term =+ case term of+ Core.TermMap _ -> setMetaUsesMap True meta+ Core.TermSet _ -> setMetaUsesSet True meta+ _ -> meta+-- | Extend metadata by analyzing a type for standard import usage (bottom-up step function)+extendMetaForType :: Environment.HaskellModuleMetadata -> Core.Type -> Environment.HaskellModuleMetadata+extendMetaForType meta typ =+ case (Strip.deannotateType typ) of+ Core.TypeLiteral v0 -> case v0 of+ Core.LiteralTypeBinary -> setMetaUsesByteString True meta+ Core.LiteralTypeInteger v1 -> case v1 of+ Core.IntegerTypeInt8 -> setMetaUsesInt True meta+ Core.IntegerTypeInt16 -> setMetaUsesInt True meta+ Core.IntegerTypeInt64 -> setMetaUsesInt True meta+ _ -> meta+ _ -> meta+ Core.TypeMap _ -> setMetaUsesMap True meta+ Core.TypeSet _ -> setMetaUsesSet True meta+ _ -> meta+-- | 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_ -> case typ_ of+ Core.TypeMap v0 ->+ let kt = Core.mapTypeKeys v0+ in (tryType names kt)+ Core.TypeSet v0 -> tryType names v0+ _ -> names+ isTypeVariable = \v -> Optionals.isNone (Names.moduleNameOf v)+ tryType =+ \names -> \t -> case (Strip.deannotateType t) of+ Core.TypeVariable v0 -> Logic.ifElse (isTypeVariable v0) (Sets.insert v0 names) names+ _ -> names+ in (Rewriting.foldOverType Coders.TraversalOrderPre fold Sets.empty typ)+-- | Gather metadata from definitions by bottom-up traversal of all terms and types+gatherMetadata :: [Packaging.Definition] -> Environment.HaskellModuleMetadata+gatherMetadata defs =++ let addDef =+ \meta -> \def -> case def of+ Packaging.DefinitionTerm v0 ->+ let term = Packaging.termDefinitionBody v0+ metaWithTerm = Rewriting.foldOverTerm Coders.TraversalOrderPre (\m -> \t -> extendMetaForTerm m t) meta term+ in (Optionals.cases (Optionals.map Scoping.termSignatureToTypeScheme (Packaging.termDefinitionSignature v0)) metaWithTerm (\ts -> Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> extendMetaForType m t) metaWithTerm (Core.typeSchemeBody ts)))+ Packaging.DefinitionType v0 ->+ let typ = Core.typeSchemeBody (Packaging.typeDefinitionBody v0)+ in (Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> extendMetaForType m t) meta typ)+ in (Lists.foldl addDef emptyMetadata defs)+-- | Get implicit typeclass constraints for type variables that need Ord+getImplicitTypeClasses :: Core.Type -> M.Map Core.Name (S.Set Core.Name)+getImplicitTypeClasses typ =++ let toPair = \name -> (name, (Sets.fromList [+ Core.Name "ordering"]))+ in (Maps.fromList (Lists.map toPair (Sets.toList (findOrdVariables typ))))+-- | Whether to include type definitions in generated Haskell modules+includeTypeDefinitions :: Bool+includeTypeDefinitions = False+-- | The key used to track Haskell variable depth in annotations+keyHaskellVar :: Core.Name+keyHaskellVar = Core.Name "haskellVar"+-- | Convert a Hydra module to Haskell source code as a filepath-to-content map+moduleToHaskell :: Packaging.Module -> [Packaging.Definition] -> t0 -> Graph.Graph -> Either Errors.Error (M.Map String String)+moduleToHaskell mod defs cx g =+ Eithers.bind (moduleToHaskellModule mod defs cx g) (\hsmod ->+ let s = Serialization.printExpr (Serialization.parenthesize (Serde.moduleToExpr hsmod))+ filepath = Names.moduleNameToFilePath Util.CaseConventionPascal (Util.FileExtension "hs") (Packaging.moduleName mod)+ in (Right (Maps.singleton filepath s)))+-- | Convert a Hydra module and definitions to a Haskell module AST+moduleToHaskellModule :: Packaging.Module -> [Packaging.Definition] -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Module+moduleToHaskellModule mod defs cx g =+ Eithers.bind (Utils.namespacesForModule mod cx g) (\namespaces -> constructModule namespaces mod defs cx g)+-- | Generate Haskell declarations for type and field name constants+nameDecls :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Core.Type -> [Syntax.Declaration]+nameDecls namespaces name typ =++ let nm = Core.unName name+ toDecl =+ \n -> \pair ->+ let k = Pairs.first pair+ v = Pairs.second pair+ in (Syntax.DeclarationValueBinding (Syntax.ValueBindingSimple (Syntax.SimpleValueBinding {+ Syntax.simpleValueBindingPattern = (Utils.applicationPattern (Utils.simpleName k) []),+ Syntax.simpleValueBindingRhs = (Syntax.RightHandSide (Syntax.ExpressionApplication (Syntax.ApplicationExpression {+ Syntax.applicationExpressionFunction = (Syntax.ExpressionVariable (Utils.elementReference namespaces n)),+ Syntax.applicationExpressionArgument = (Syntax.ExpressionLiteral (Syntax.LiteralString v))}))),+ Syntax.simpleValueBindingLocalBindings = Nothing,+ Syntax.simpleValueBindingComments = Nothing})))+ nameDecl = (constantForTypeName name, nm)+ fieldDecls = Lists.map toConstant (Lexical.fieldsOf typ)+ toConstant =+ \fieldType ->+ let fname = Core.fieldTypeName fieldType+ 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)) [])+setMetaUsesByteString :: Bool -> Environment.HaskellModuleMetadata -> Environment.HaskellModuleMetadata+setMetaUsesByteString b m =+ Environment.HaskellModuleMetadata {+ Environment.haskellModuleMetadataUsesByteString = b,+ Environment.haskellModuleMetadataUsesInt = (Environment.haskellModuleMetadataUsesInt m),+ Environment.haskellModuleMetadataUsesMap = (Environment.haskellModuleMetadataUsesMap m),+ Environment.haskellModuleMetadataUsesSet = (Environment.haskellModuleMetadataUsesSet m)}+setMetaUsesInt :: Bool -> Environment.HaskellModuleMetadata -> Environment.HaskellModuleMetadata+setMetaUsesInt b m =+ Environment.HaskellModuleMetadata {+ Environment.haskellModuleMetadataUsesByteString = (Environment.haskellModuleMetadataUsesByteString m),+ Environment.haskellModuleMetadataUsesInt = b,+ Environment.haskellModuleMetadataUsesMap = (Environment.haskellModuleMetadataUsesMap m),+ Environment.haskellModuleMetadataUsesSet = (Environment.haskellModuleMetadataUsesSet m)}+setMetaUsesMap :: Bool -> Environment.HaskellModuleMetadata -> Environment.HaskellModuleMetadata+setMetaUsesMap b m =+ Environment.HaskellModuleMetadata {+ Environment.haskellModuleMetadataUsesByteString = (Environment.haskellModuleMetadataUsesByteString m),+ Environment.haskellModuleMetadataUsesInt = (Environment.haskellModuleMetadataUsesInt m),+ Environment.haskellModuleMetadataUsesMap = b,+ Environment.haskellModuleMetadataUsesSet = (Environment.haskellModuleMetadataUsesSet m)}+setMetaUsesSet :: Bool -> Environment.HaskellModuleMetadata -> Environment.HaskellModuleMetadata+setMetaUsesSet b m =+ Environment.HaskellModuleMetadata {+ Environment.haskellModuleMetadataUsesByteString = (Environment.haskellModuleMetadataUsesByteString m),+ Environment.haskellModuleMetadataUsesInt = (Environment.haskellModuleMetadataUsesInt m),+ Environment.haskellModuleMetadataUsesMap = (Environment.haskellModuleMetadataUsesMap m),+ Environment.haskellModuleMetadataUsesSet = b}+-- | Convert a Hydra term definition to a Haskell declaration with comments+toDataDeclaration :: Util.ModuleNames Syntax.ModuleName -> Packaging.TermDefinition -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Declaration+toDataDeclaration namespaces def cx g =++ let name = Packaging.termDefinitionName def+ term = Packaging.termDefinitionBody def+ typ = Optionals.map Scoping.termSignatureToTypeScheme (Packaging.termDefinitionSignature def)+ hname = Utils.simpleName (Names.localNameOf name)+ rewriteValueBinding =+ \vb -> case vb of+ Syntax.ValueBindingSimple v0 ->+ let pattern_ = Syntax.simpleValueBindingPattern v0+ rhs = Syntax.simpleValueBindingRhs v0+ bindings = Syntax.simpleValueBindingLocalBindings v0+ in case pattern_ of+ Syntax.PatternApplication v1 ->+ let name_ = Syntax.applicationPatternName v1+ args = Syntax.applicationPatternArgs v1+ rhsExpr = Syntax.unRightHandSide rhs+ in case rhsExpr of+ Syntax.ExpressionLambda v2 ->+ let vars = Syntax.lambdaExpressionBindings v2+ body = Syntax.lambdaExpressionInner v2+ newPattern = Utils.applicationPattern name_ (Lists.concat2 args vars)+ newRhs = Syntax.RightHandSide body+ in (rewriteValueBinding (Syntax.ValueBindingSimple (Syntax.SimpleValueBinding {+ Syntax.simpleValueBindingPattern = newPattern,+ Syntax.simpleValueBindingRhs = newRhs,+ Syntax.simpleValueBindingLocalBindings = bindings,+ Syntax.simpleValueBindingComments = Nothing})))+ _ -> vb+ _ -> vb+ toDecl =+ \comments -> \hname_ -> \term_ -> \bindings -> case (Strip.deannotateTerm term_) of+ Core.TermLet v0 ->+ let lbindings = Core.letBindings v0+ env = Core.letBody v0+ toTermDefinition = \hname_ -> \hterm_ -> Syntax.LocalBindingValue (Utils.simpleValueBinding hname_ hterm_ Nothing)+ hnames = Lists.map (\binding -> Utils.simpleName (Core.unName (Core.bindingName binding))) lbindings+ terms = Lists.map Core.bindingTerm lbindings+ in (Eithers.bind (Eithers.mapList (\t -> encodeTerm 0 namespaces t cx g) terms) (\hterms ->+ let hbindings = Lists.zipWith toTermDefinition hnames hterms+ prevBindings = Optionals.cases bindings [] (\lb -> Syntax.unLocalBindings lb)+ allBindings = Lists.concat2 prevBindings hbindings+ in (toDecl comments hname_ env (Just (Syntax.LocalBindings allBindings)))))+ _ -> Eithers.bind (encodeTerm 0 namespaces term_ cx g) (\hterm ->+ let vb = Utils.simpleValueBinding hname_ hterm bindings+ schemeConstraints = Optionals.cases typ Nothing (\ts -> Core.typeSchemeConstraints ts)+ schemeClasses = typeSchemeConstraintsToClassMap schemeConstraints+ in (Eithers.bind (Annotations.getTypeClasses cx g (Strip.removeTypesFromTerm term)) (\explicitClasses ->+ let combinedClasses = Maps.union schemeClasses explicitClasses+ schemeType = Optionals.cases typ Core.TypeUnit (\ts -> Core.typeSchemeBody ts)+ in (Eithers.bind (encodeTypeWithClassAssertions namespaces combinedClasses schemeType cx g) (\htype ->+ let decl =+ Syntax.DeclarationTypedBinding (Syntax.TypedBinding {+ Syntax.typedBindingTypeSignature = Syntax.TypeSignature {+ Syntax.typeSignatureName = hname_,+ Syntax.typeSignatureType = htype},+ Syntax.typedBindingValueBinding = (rewriteValueBinding vb),+ Syntax.typedBindingComments = comments})+ in (Right decl))))))+ in (Eithers.bind (Annotations.getTermDescription cx g term) (\comments -> toDecl comments hname term Nothing))+-- | Convert a Hydra type definition to Haskell declarations+toTypeDeclarationsFrom :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Core.Type -> t0 -> Graph.Graph -> Either Errors.Error [Syntax.Declaration]+toTypeDeclarationsFrom namespaces elementName typ cx g =++ let lname = Names.localNameOf elementName+ hname = Utils.simpleName lname+ declHead =+ \name -> \vars_ -> Optionals.fromOptional (Syntax.DeclarationHeadSimple name) (Optionals.map (\p ->+ let h = Pairs.first p+ rest = Pairs.second p+ hvar = Syntax.Variable (Utils.simpleName (Core.unName h))+ in (Syntax.DeclarationHeadApplication (Syntax.ApplicationDeclarationHead {+ Syntax.applicationDeclarationHeadFunction = (declHead name rest),+ Syntax.applicationDeclarationHeadOperand = hvar}))) (Lists.uncons vars_))+ newtypeCons =+ \tname -> \typ_ ->+ let hname0 = Utils.simpleName (Utils.newtypeAccessorName tname)+ in (Eithers.bind (adaptTypeToHaskellAndEncode namespaces typ_ cx g) (\htype ->+ let hfield =+ Syntax.Field {+ Syntax.fieldName = hname0,+ Syntax.fieldType = htype,+ Syntax.fieldComments = Nothing}+ constructorName = Utils.simpleName (Names.localNameOf tname)+ in (Right (Syntax.ConstructorRecord (Syntax.RecordConstructor {+ Syntax.recordConstructorName = constructorName,+ Syntax.recordConstructorFields = [+ hfield],+ Syntax.recordConstructorComments = Nothing})))))+ recordCons =+ \lname_ -> \fields ->+ let toField =+ \fieldType ->+ let fname = Core.fieldTypeName fieldType+ ftype = Core.fieldTypeType fieldType+ hname_ = Utils.simpleName (Strings.cat2 (Formatting.decapitalize lname_) (Formatting.capitalize (Core.unName fname)))+ in (Eithers.bind (adaptTypeToHaskellAndEncode namespaces ftype cx g) (\htype -> Eithers.bind (Annotations.getTypeDescription cx g ftype) (\comments -> Right (Syntax.Field {+ Syntax.fieldName = hname_,+ Syntax.fieldType = htype,+ Syntax.fieldComments = comments}))))+ in (Eithers.bind (Eithers.mapList toField fields) (\hFields -> Right (Syntax.ConstructorRecord (Syntax.RecordConstructor {+ Syntax.recordConstructorName = (Utils.simpleName lname_),+ Syntax.recordConstructorFields = hFields,+ Syntax.recordConstructorComments = Nothing}))))+ unionCons =+ \boundNames_ -> \lname_ -> \fieldType ->+ let fname = Core.fieldTypeName fieldType+ ftype = Core.fieldTypeType fieldType+ deconflict =+ \name ->+ let tname =+ Names.unqualifyName (Util.QualifiedName {+ Util.qualifiedNameModuleName = (Just (Pairs.first (Util.moduleNamesFocus namespaces))),+ Util.qualifiedNameLocal = name})+ in (Logic.ifElse (Sets.member tname boundNames_) (deconflict (Strings.cat2 name "_")) name)+ in (Eithers.bind (Annotations.getTypeDescription cx g ftype) (\comments ->+ let nm = deconflict (Strings.cat2 (Formatting.capitalize lname_) (Formatting.capitalize (Core.unName fname)))+ in (Eithers.bind (Logic.ifElse (Equality.equal (Strip.deannotateType ftype) Core.TypeUnit) (Right []) (Eithers.bind (adaptTypeToHaskellAndEncode namespaces ftype cx g) (\htype -> Right [+ htype]))) (\typeList -> Right (Syntax.ConstructorOrdinary (Syntax.PositionalConstructor {+ Syntax.positionalConstructorName = (Utils.simpleName nm),+ Syntax.positionalConstructorFields = typeList,+ Syntax.positionalConstructorComments = comments}))))))+ in (Eithers.bind (Predicates.isSerializableByName cx g elementName) (\isSer ->+ let deriv =+ Syntax.DerivingClause (Logic.ifElse isSer (Lists.map Utils.rawName [+ "Eq",+ "Ord",+ "Read",+ "Show"]) [])+ unpackResult = Utils.unpackForallType typ+ vars = Pairs.first unpackResult+ t_ = Pairs.second unpackResult+ hd = declHead hname (Lists.reverse vars)+ in (Eithers.bind (Annotations.getTypeDescription cx g typ) (\comments -> Eithers.bind (case (Strip.deannotateType t_) of+ Core.TypeRecord v0 -> Eithers.bind (recordCons lname v0) (\cons -> Right (Syntax.DeclarationData (Syntax.DataDeclaration {+ Syntax.dataDeclarationKeyword = Syntax.DataKeywordData,+ Syntax.dataDeclarationContext = [],+ Syntax.dataDeclarationHead = hd,+ Syntax.dataDeclarationConstructors = [+ cons],+ Syntax.dataDeclarationDeriving = [+ deriv],+ Syntax.dataDeclarationComments = comments})))+ Core.TypeUnion v0 -> Eithers.bind (Eithers.mapList (unionCons (Sets.fromList (Maps.keys (Graph.graphBoundTerms g))) lname) v0) (\cons -> Right (Syntax.DeclarationData (Syntax.DataDeclaration {+ Syntax.dataDeclarationKeyword = Syntax.DataKeywordData,+ Syntax.dataDeclarationContext = [],+ Syntax.dataDeclarationHead = hd,+ Syntax.dataDeclarationConstructors = cons,+ Syntax.dataDeclarationDeriving = [+ deriv],+ Syntax.dataDeclarationComments = comments})))+ Core.TypeWrap v0 -> Eithers.bind (newtypeCons elementName v0) (\cons -> Right (Syntax.DeclarationData (Syntax.DataDeclaration {+ Syntax.dataDeclarationKeyword = Syntax.DataKeywordNewtype,+ Syntax.dataDeclarationContext = [],+ Syntax.dataDeclarationHead = hd,+ Syntax.dataDeclarationConstructors = [+ cons],+ Syntax.dataDeclarationDeriving = [+ deriv],+ Syntax.dataDeclarationComments = comments})))+ _ -> Eithers.bind (adaptTypeToHaskellAndEncode namespaces typ cx g) (\htype -> Right (Syntax.DeclarationType (Syntax.TypeSynonymDeclaration {+ Syntax.typeSynonymDeclarationName = hd,+ Syntax.typeSynonymDeclarationType = htype,+ Syntax.typeSynonymDeclarationComments = comments})))) (\decl -> Eithers.bind (Logic.ifElse includeTypeDefinitions (Eithers.bind (typeDecl namespaces elementName typ cx g) (\decl_ -> Right [+ decl_])) (Right [])) (\tdecls ->+ let nameDecls_ = nameDecls namespaces elementName typ+ in (Right (Lists.concat [+ [+ decl],+ nameDecls_,+ tdecls]))))))))+-- | Generate a Haskell declaration for a type definition constant+typeDecl :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Core.Type -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Declaration+typeDecl namespaces name typ cx g =++ let typeName = \ns -> \name_ -> Names.qname ns (typeNameLocal name_)+ typeNameLocal =+ \name_ -> Strings.cat [+ "_",+ (Names.localNameOf name_),+ "_type_"]+ rawTerm = EncodeCore.type_ typ+ rewrite =+ \recurse -> \term ->+ let variantResult =+ case (Strip.deannotateTerm term) of+ Core.TermInject v0 -> Logic.ifElse (Equality.equal (Core.injectionTypeName v0) (Core.Name "hydra.core.Type")) (Just (Core.injectionField v0)) Nothing+ _ -> Nothing+ decodeString =+ \term2 -> case (Strip.deannotateTerm term2) of+ Core.TermLiteral v0 -> case v0 of+ Core.LiteralString v1 -> Just v1+ _ -> Nothing+ _ -> Nothing+ decodeName =+ \term2 -> case (Strip.deannotateTerm term2) of+ Core.TermWrap v0 -> Logic.ifElse (Equality.equal (Core.wrappedTermTypeName v0) (Core.Name "hydra.core.Name")) (Optionals.map (\x -> Core.Name x) (decodeString (Core.wrappedTermBody v0))) Nothing+ _ -> Nothing+ 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 (decodeName fterm) forVariableType) Nothing))+ forVariableType =+ \vname ->+ let qname = Names.qualifyName vname+ mns = Util.qualifiedNameModuleName qname+ local = Util.qualifiedNameLocal qname+ in (Optionals.map (\ns -> Core.TermVariable (Names.qname ns (Strings.cat [+ "_",+ local,+ "_type_"]))) mns)+ in (Optionals.fromOptional (recurse term) (Optionals.bind variantResult forType))+ finalTerm = Rewriting.rewriteTerm rewrite rawTerm+ in (Eithers.bind (encodeTerm 0 namespaces finalTerm cx g) (\expr ->+ let rhs = Syntax.RightHandSide expr+ hname = Utils.simpleName (typeNameLocal name)+ pat = Utils.applicationPattern hname []+ decl =+ Syntax.DeclarationValueBinding (Syntax.ValueBindingSimple (Syntax.SimpleValueBinding {+ Syntax.simpleValueBindingPattern = pat,+ Syntax.simpleValueBindingRhs = rhs,+ Syntax.simpleValueBindingLocalBindings = Nothing,+ Syntax.simpleValueBindingComments = Nothing}))+ in (Right decl)))+-- | Project type scheme constraints to a map of type variables to typeclass names+typeSchemeConstraintsToClassMap :: Ord t0 => (Maybe (M.Map t0 Core.TypeVariableConstraints) -> M.Map t0 (S.Set Core.Name))+typeSchemeConstraintsToClassMap maybeConstraints =++ let constraintToName =+ \tcc -> case tcc of+ Core.TypeClassConstraintSimple v0 -> Just v0+ in (Optionals.cases maybeConstraints Maps.empty (\constraints -> Maps.map (\meta -> Sets.fromList (Optionals.cat (Lists.map constraintToName (Core.typeVariableConstraintsClasses meta)))) constraints))+-- | Whether to use the Hydra core import in generated modules+useCoreImport :: Bool+useCoreImport = True
+ src/main/haskell/Hydra/Haskell/Environment.hs view
@@ -0,0 +1,24 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Environment types for Haskell code generation++module Hydra.Haskell.Environment where+import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | Metadata used to determine which standard imports are needed in a generated Haskell module+data HaskellModuleMetadata =+ HaskellModuleMetadata {+ -- | Whether the module uses Data.ByteString (B.ByteString)+ haskellModuleMetadataUsesByteString :: Bool,+ -- | Whether the module uses Data.Int (I.Int8, I.Int16, I.Int64)+ haskellModuleMetadataUsesInt :: Bool,+ -- | Whether the module uses Data.Map (M.Map, M.fromList, M.empty)+ haskellModuleMetadataUsesMap :: Bool,+ -- | Whether the module uses Data.Set (S.Set, S.fromList, S.empty)+ haskellModuleMetadataUsesSet :: Bool}+ deriving (Eq, Ord, Read, Show)+_HaskellModuleMetadata = Core.Name "hydra.haskell.environment.HaskellModuleMetadata"+_HaskellModuleMetadata_usesByteString = Core.Name "usesByteString"+_HaskellModuleMetadata_usesInt = Core.Name "usesInt"+_HaskellModuleMetadata_usesMap = Core.Name "usesMap"+_HaskellModuleMetadata_usesSet = Core.Name "usesSet"
+ src/main/haskell/Hydra/Haskell/Language.hs view
@@ -0,0 +1,171 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Language constraints and reserved words for Haskell++module Hydra.Haskell.Language where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Haskell.Lib.Lists as Lists+import qualified Hydra.Haskell.Lib.Sets as Sets+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Set as S+-- | Language constraints for Haskell+haskellLanguage :: Coders.Language+haskellLanguage =+ Coders.Language {+ Coders.languageName = (Coders.LanguageName "hydra.haskell"),+ Coders.languageConstraints = Coders.LanguageConstraints {+ Coders.languageConstraintsLiteralVariants = literalVariants,+ Coders.languageConstraintsFloatTypes = floatTypes,+ Coders.languageConstraintsIntegerTypes = integerTypes,+ Coders.languageConstraintsTermVariants = termVariants,+ Coders.languageConstraintsTypeVariants = typeVariants,+ Coders.languageConstraintsTypes = typePredicate},+ Coders.languageSupportedFeatures = (Sets.fromList [+ Coders.LanguageFeaturePartialApplication,+ Coders.LanguageFeatureNestedCaseStatements,+ Coders.LanguageFeatureNestedPolymorphicLetBindings]),+ Coders.languageCaseConventions = Coders.CaseConventions {+ Coders.caseConventionsConstant = Util.CaseConventionUpperSnake,+ Coders.caseConventionsDirectory = Util.CaseConventionPascal,+ Coders.caseConventionsEnumValue = Util.CaseConventionPascal,+ Coders.caseConventionsField = Util.CaseConventionCamel,+ Coders.caseConventionsFile = Util.CaseConventionPascal,+ Coders.caseConventionsModule = Util.CaseConventionPascal,+ Coders.caseConventionsTerm = Util.CaseConventionCamel,+ Coders.caseConventionsTermVariable = Util.CaseConventionCamel,+ Coders.caseConventionsType = Util.CaseConventionPascal,+ Coders.caseConventionsTypeVariable = Util.CaseConventionCamel},+ Coders.languageDefaultFileExtension = (Util.FileExtension "hs")}+ where+ literalVariants =+ Sets.fromList [+ Variants.LiteralVariantBinary,+ Variants.LiteralVariantBoolean,+ Variants.LiteralVariantDecimal,+ Variants.LiteralVariantFloat,+ Variants.LiteralVariantInteger,+ Variants.LiteralVariantString]+ floatTypes =+ Sets.fromList [+ Core.FloatTypeFloat32,+ Core.FloatTypeFloat64]+ integerTypes =+ Sets.fromList [+ Core.IntegerTypeBigint,+ Core.IntegerTypeInt8,+ Core.IntegerTypeInt16,+ Core.IntegerTypeInt32,+ Core.IntegerTypeInt64]+ termVariants =+ Sets.fromList [+ Variants.TermVariantAnnotated,+ Variants.TermVariantApplication,+ Variants.TermVariantCases,+ Variants.TermVariantEither,+ Variants.TermVariantLambda,+ Variants.TermVariantLet,+ Variants.TermVariantList,+ Variants.TermVariantLiteral,+ Variants.TermVariantMap,+ Variants.TermVariantOptional,+ Variants.TermVariantPair,+ Variants.TermVariantProject,+ Variants.TermVariantRecord,+ Variants.TermVariantSet,+ Variants.TermVariantTypeApplication,+ Variants.TermVariantTypeLambda,+ Variants.TermVariantInject,+ Variants.TermVariantUnit,+ Variants.TermVariantUnwrap,+ Variants.TermVariantVariable,+ Variants.TermVariantWrap]+ typeVariants =+ Sets.fromList [+ Variants.TypeVariantAnnotated,+ Variants.TypeVariantApplication,+ Variants.TypeVariantEither,+ Variants.TypeVariantFunction,+ Variants.TypeVariantForall,+ Variants.TypeVariantList,+ Variants.TypeVariantLiteral,+ Variants.TypeVariantMap,+ Variants.TypeVariantOptional,+ Variants.TypeVariantPair,+ Variants.TypeVariantRecord,+ Variants.TypeVariantSet,+ Variants.TypeVariantUnion,+ Variants.TypeVariantUnit,+ Variants.TypeVariantVariable,+ Variants.TypeVariantVoid,+ Variants.TypeVariantWrap]+ typePredicate = \_ -> True+-- | Created on 2025-02-28 using GHCi 9.6.6+-- |+-- | You can reproduce these lists of symbols by issuing the command `:browse Prelude` in GHCi, pasting the results into+-- | /tmp/browse_Prelude.txt, and then running the Bash command provided with each list.+-- |+-- | See also https://www.haskell.org/onlinereport/standard-prelude.html+reservedWords :: S.Set String+reservedWords = Sets.fromList (Lists.concat2 keywordSymbols reservedSymbols)+ where+ keywordSymbols =+ [+ "case",+ "class",+ "data",+ "default",+ "deriving",+ "do",+ "else",+ "forall",+ "foreign",+ "if",+ "import",+ "in",+ "infix",+ "infixl",+ "infixr",+ "instance",+ "let",+ "module",+ "newtype",+ "of",+ "then",+ "type",+ "where"]+ reservedSymbols =+ [+ "Bool",+ "Double",+ "False",+ "Float",+ "Int",+ "Integer",+ "Just",+ "Maybe",+ "Nothing",+ "Ord",+ "Show",+ "String",+ "True"]
+ src/main/haskell/Hydra/Haskell/Operators.hs view
@@ -0,0 +1,139 @@+-- Note: this is an automatically generated file. Do not edit.+-- | AST operators for Haskell++module Hydra.Haskell.Operators where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Haskell.Lib.Math as Math+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | Logical AND operator (&&)+andOp :: Ast.Op+andOp = Serialization.op "&&" 3 Ast.AssociativityRight+-- | Applicative apply operator (<*>)+apOp :: Ast.Op+apOp = Serialization.op "<*>" 4 Ast.AssociativityLeft+-- | Function application operator (whitespace)+appOp :: Ast.Op+appOp =+ 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.AssociativityLeft}+-- | Low-precedence function application ($)+applyOp :: Ast.Op+applyOp = Serialization.op "$" 0 Ast.AssociativityRight+-- | Function type arrow (->)+arrowOp :: Ast.Op+arrowOp = Serialization.op "->" (Math.negate 1) Ast.AssociativityRight+-- | 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+-- | 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+-- | 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+-- | Lambda body arrow (->)+lambdaOp :: Ast.Op+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+-- | Subtraction (-). Originally: associativityLeft+minusOp :: Ast.Op+minusOp = Serialization.op "-" 6 Ast.AssociativityBoth+-- | Modulo (`mod`)+modOp :: Ast.Op+modOp = Serialization.op "`mod`" 7 Ast.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+-- | 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+-- | Type annotation (::)+typeOp :: Ast.Op+typeOp = Serialization.op "::" 0 Ast.AssociativityNone
+ src/main/haskell/Hydra/Haskell/Serde.hs view
@@ -0,0 +1,448 @@+-- 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 (->)"+-- | Operator names are drawn (loosely) from:+-- | https://stackoverflow.com/questions/7746894/are-there-pronounceable-names-for-common-haskell-operators++module Hydra.Haskell.Serde where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Constants as Constants+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Graph as Graph+import qualified Hydra.Haskell.Operators as Operators+import qualified Hydra.Haskell.Syntax as Syntax+import qualified Hydra.Json.Model as Model+import qualified Hydra.Haskell.Lib.Equality as Equality+import qualified Hydra.Haskell.Lib.Lists as Lists+import qualified Hydra.Haskell.Lib.Literals as Literals+import qualified Hydra.Haskell.Lib.Logic as Logic+import qualified Hydra.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Haskell.Lib.Strings as Strings+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | Convert a pattern-matching alternative to an AST expression+alternativeToExpr :: Syntax.Alternative -> Ast.Expr+alternativeToExpr alt =+ Serialization.structuralSpaceSep [+ patternToExpr (Syntax.alternativePattern alt),+ (Serialization.cst "->"),+ (caseRhsToExpr (Syntax.alternativeRhs alt))]+-- | Convert a function application expression to an AST expression+applicationExpressionToExpr :: Syntax.ApplicationExpression -> Ast.Expr+applicationExpressionToExpr app =+ Serialization.ifx Operators.appOp (expressionToExpr (Syntax.applicationExpressionFunction app)) (expressionToExpr (Syntax.applicationExpressionArgument app))+-- | Convert an application pattern to an AST expression+applicationPatternToExpr :: Syntax.ApplicationPattern -> Ast.Expr+applicationPatternToExpr appPat =++ let name = Syntax.applicationPatternName appPat+ pats = Syntax.applicationPatternArgs appPat+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) (Lists.map patternToExpr pats)))+-- | Convert a case expression to an AST expression+caseExpressionToExpr :: Syntax.CaseExpression -> Ast.Expr+caseExpressionToExpr caseExpr =++ let cs = Syntax.caseExpressionCase caseExpr+ alts = Syntax.caseExpressionAlternatives caseExpr+ ofOp =+ 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}+ lhs =+ Serialization.spaceSep [+ Serialization.cst "case",+ (expressionToExpr cs)]+ rhs = Serialization.newlineSep (Lists.map alternativeToExpr alts)+ in (Serialization.ifx ofOp lhs rhs)+-- | Convert a case right-hand side to an AST expression+caseRhsToExpr :: Syntax.CaseRhs -> Ast.Expr+caseRhsToExpr rhs = expressionToExpr (Syntax.unCaseRhs rhs)+-- | Convert a class constraint to an AST expression+classConstraintToExpr :: Syntax.ClassConstraint -> Ast.Expr+classConstraintToExpr clsAsrt =++ let name = Syntax.classConstraintName clsAsrt+ types = Syntax.classConstraintTypes clsAsrt+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.commaSep Serialization.halfBlockStyle (Lists.map typeToExpr types)]))+-- | Convert a type class constraint to an AST expression+constraintToExpr :: Syntax.Constraint -> Ast.Expr+constraintToExpr sert =+ case sert of+ Syntax.ConstraintClass v0 -> classConstraintToExpr v0+ Syntax.ConstraintTuple v0 -> Serialization.parenList False (Lists.map constraintToExpr v0)+-- | Convert a data constructor to an AST expression+constructorToExpr :: Syntax.Constructor -> Ast.Expr+constructorToExpr cons =++ let mc =+ case cons of+ Syntax.ConstructorOrdinary v0 -> Syntax.positionalConstructorComments v0+ Syntax.ConstructorRecord v0 -> Syntax.recordConstructorComments v0+ body =+ case cons of+ Syntax.ConstructorOrdinary v0 ->+ let name = Syntax.positionalConstructorName v0+ types = Syntax.positionalConstructorFields v0+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.spaceSep (Lists.map typeToExpr types)]))+ Syntax.ConstructorRecord v0 ->+ let name = Syntax.recordConstructorName v0+ fields = Syntax.recordConstructorFields v0+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.curlyBracesList Nothing Serialization.halfBlockStyle (Lists.map fieldToExpr fields)]))+ in (Optionals.cases mc body (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ body])))+-- | Convert a data/newtype keyword to an AST expression+dataKeywordToExpr :: Syntax.DataKeyword -> Ast.Expr+dataKeywordToExpr kw =+ case kw of+ Syntax.DataKeywordData -> Serialization.cst "data"+ Syntax.DataKeywordNewtype -> Serialization.cst "newtype"+-- | Convert a declaration head to an AST expression+declarationHeadToExpr :: Syntax.DeclarationHead -> Ast.Expr+declarationHeadToExpr hd =+ case hd of+ Syntax.DeclarationHeadApplication v0 ->+ let fun = Syntax.applicationDeclarationHeadFunction v0+ op = Syntax.applicationDeclarationHeadOperand v0+ in (Serialization.spaceSep (Lists.cons (declarationHeadToExpr fun) [+ variableToExpr op]))+ Syntax.DeclarationHeadSimple v0 -> nameToExpr v0+-- | Convert a declaration to an AST expression+declarationToExpr :: Syntax.Declaration -> Ast.Expr+declarationToExpr decl =++ let mc =+ case decl of+ Syntax.DeclarationData v0 -> Syntax.dataDeclarationComments v0+ Syntax.DeclarationType v0 -> Syntax.typeSynonymDeclarationComments v0+ Syntax.DeclarationValueBinding v0 -> case v0 of+ Syntax.ValueBindingSimple v1 -> Syntax.simpleValueBindingComments v1+ Syntax.DeclarationTypedBinding v0 -> Syntax.typedBindingComments v0+ body =+ case decl of+ Syntax.DeclarationData v0 ->+ let kw = Syntax.dataDeclarationKeyword v0+ hd = Syntax.dataDeclarationHead v0+ cons = Syntax.dataDeclarationConstructors v0+ deriv = Syntax.dataDeclarationDeriving v0+ derivCat = Lists.concat (Lists.map Syntax.unDerivingClause deriv)+ constructors = Serialization.orSep Serialization.halfBlockStyle (Lists.map constructorToExpr cons)+ derivingClause =+ Logic.ifElse (Lists.null derivCat) [] [+ Serialization.spaceSep (Lists.cons (Serialization.cst "deriving") [+ Serialization.parenList False (Lists.map nameToExpr derivCat)])]+ mainParts =+ [+ Serialization.spaceSep (Lists.cons (dataKeywordToExpr kw) (Lists.cons (declarationHeadToExpr hd) [+ Serialization.cst "="])),+ constructors]+ in (Serialization.indentBlock (Lists.concat2 mainParts derivingClause))+ Syntax.DeclarationType v0 ->+ let hd = Syntax.typeSynonymDeclarationName v0+ typ = Syntax.typeSynonymDeclarationType v0+ in (Serialization.spaceSep (Lists.cons (Serialization.cst "type") (Lists.cons (declarationHeadToExpr hd) (Lists.cons (Serialization.cst "=") [+ typeToExpr typ]))))+ Syntax.DeclarationValueBinding v0 -> valueBindingToExpr v0+ Syntax.DeclarationTypedBinding v0 ->+ let typeSig = Syntax.typedBindingTypeSignature v0+ vb = Syntax.typedBindingValueBinding v0+ name = Syntax.typeSignatureName typeSig+ htype = Syntax.typeSignatureType typeSig+ in (Serialization.newlineSep (Lists.cons (Serialization.structuralSpaceSep [+ nameToExpr name,+ (Serialization.cst "::"),+ (typeToExpr htype)]) [+ valueBindingToExpr vb]))+ in (Optionals.cases mc body (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ body])))+-- | Convert a Haskell expression to an AST expression+expressionToExpr :: Syntax.Expression -> Ast.Expr+expressionToExpr expr =+ case expr of+ Syntax.ExpressionApplication v0 -> applicationExpressionToExpr v0+ Syntax.ExpressionCase v0 -> caseExpressionToExpr v0+ Syntax.ExpressionConstructRecord v0 -> recordExpressionToExpr v0+ Syntax.ExpressionDo v0 -> Serialization.indentBlock (Lists.cons (Serialization.cst "do") (Lists.map statementToExpr v0))+ Syntax.ExpressionIf v0 -> ifExpressionToExpr v0+ Syntax.ExpressionLiteral v0 -> literalToExpr v0+ Syntax.ExpressionLambda v0 -> Serialization.parenthesize (lambdaExpressionToExpr v0)+ Syntax.ExpressionLet v0 ->+ let bindings = Syntax.letExpressionBindings v0+ inner = Syntax.letExpressionInner v0+ encodeBinding = \binding -> Serialization.indentSubsequentLines " " (localBindingToExpr binding)+ 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])])))+ Syntax.ExpressionList v0 -> Serialization.bracketList Serialization.halfBlockStyle (Lists.map expressionToExpr v0)+ Syntax.ExpressionTuple v0 -> Serialization.parenListAdaptive (Lists.map expressionToExpr v0)+ Syntax.ExpressionVariable v0 -> nameToExpr v0+-- | Convert a field declaration to an AST expression+fieldToExpr :: Syntax.Field -> Ast.Expr+fieldToExpr field =++ let name = Syntax.fieldName field+ typ = Syntax.fieldType field+ mc = Syntax.fieldComments field+ body = Serialization.spaceSep (Lists.cons (nameToExpr name) (Lists.cons (Serialization.cst "::") [+ typeToExpr typ]))+ in (Optionals.cases mc body (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ body])))+-- | Convert an if-then-else expression to an AST expression+ifExpressionToExpr :: Syntax.IfExpression -> Ast.Expr+ifExpressionToExpr ifExpr =++ let eif = Syntax.ifExpressionCondition ifExpr+ ethen = Syntax.ifExpressionThen ifExpr+ eelse = Syntax.ifExpressionElse ifExpr+ ifOp =+ Ast.Op {+ Ast.opSymbol = (Ast.Symbol ""),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsNone,+ Ast.paddingRight = (Ast.WsBreakAndIndent " ")},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}+ 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 statement to an AST expression+importToExpr :: Syntax.Import -> Ast.Expr+importToExpr import_ =++ let qual = Syntax.importQualified import_+ modName = Syntax.importModule import_+ mod = Syntax.importAs import_+ mspec = Syntax.importSpec import_+ name = Syntax.unModuleName modName+ hidingSec =+ \spec -> case spec of+ Syntax.ImportSpecHiding v0 -> Serialization.spaceSep (Lists.cons (Serialization.cst "hiding ") [+ Serialization.parens (Serialization.commaSep Serialization.inlineStyle (Lists.map namedImportExportToExpr v0))])+ parts =+ Optionals.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 " (Syntax.unModuleName m))) mod),+ (Optionals.map hidingSec mspec)]+ in (Serialization.spaceSep parts)+-- | Convert a lambda expression to an AST expression+lambdaExpressionToExpr :: Syntax.LambdaExpression -> Ast.Expr+lambdaExpressionToExpr lambdaExpr =++ let bindings = Syntax.lambdaExpressionBindings lambdaExpr+ inner = Syntax.lambdaExpressionInner lambdaExpr+ head = Serialization.spaceSep (Lists.map patternToExpr bindings)+ body = expressionToExpr inner+ in (Serialization.ifx Operators.lambdaOp (Serialization.prefix "\\" head) body)+-- | Convert a literal value to an AST expression+literalToExpr :: Syntax.Literal -> Ast.Expr+literalToExpr lit =++ let parensIfNeg =+ \b -> \e -> Logic.ifElse b (Strings.cat [+ "(",+ e,+ ")"]) e+ showFloat =+ \showFn -> \v ->+ let raw = showFn v+ in (Logic.ifElse (Equality.equal raw "NaN") "(0/0)" (Logic.ifElse (Equality.equal raw "Infinity") "(1/0)" (Logic.ifElse (Equality.equal raw "-Infinity") "(-(1/0))" (parensIfNeg (Equality.equal (Optionals.fromOptional 0 (Strings.maybeCharAt 0 raw)) 45) raw))))+ in (Serialization.cst (case lit of+ Syntax.LiteralChar v0 -> Literals.showString (Literals.showUint16 v0)+ Syntax.LiteralDouble v0 -> showFloat (\v -> Literals.showFloat64 v) v0+ Syntax.LiteralFloat v0 -> showFloat (\v -> Literals.showFloat32 v) v0+ Syntax.LiteralInt v0 -> parensIfNeg (Equality.lt v0 0) (Literals.showInt32 v0)+ Syntax.LiteralInteger v0 -> parensIfNeg (Equality.lt v0 0) (Literals.showBigint v0)+ Syntax.LiteralString v0 -> Literals.showString v0))+-- | Convert a local binding to an AST expression+localBindingToExpr :: Syntax.LocalBinding -> Ast.Expr+localBindingToExpr binding =+ case binding of+ Syntax.LocalBindingSignature v0 -> typeSignatureToExpr v0+ Syntax.LocalBindingValue v0 -> valueBindingToExpr v0+-- | Convert a module head to an AST expression+moduleHeadToExpr :: Syntax.ModuleHead -> Ast.Expr+moduleHeadToExpr moduleHead =++ let mc = Syntax.moduleHeadComments moduleHead+ modName = Syntax.moduleHeadName moduleHead+ mname = Syntax.unModuleName modName+ head =+ Serialization.spaceSep (Lists.cons (Serialization.cst "module") (Lists.cons (Serialization.cst mname) [+ Serialization.cst "where"]))+ in (Optionals.cases mc head (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) (Lists.cons (Serialization.cst "") [+ head]))))+-- | Convert a Haskell module to an AST expression+moduleToExpr :: Syntax.Module -> Ast.Expr+moduleToExpr module_ =++ let mh = Syntax.moduleHead module_+ imports = Syntax.moduleImports module_+ decls = Syntax.moduleDeclarations module_+ warning = [+ Serialization.cst (toSimpleComments Constants.warningAutoGeneratedFile)]+ headerLine = Optionals.cases mh [] (\h -> [+ moduleHeadToExpr h])+ declLines = Lists.map declarationToExpr 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 :: Syntax.Name -> Ast.Expr+nameToExpr name =+ Serialization.cst (case name of+ Syntax.NameImplicit v0 -> Strings.cat2 "?" (writeQualifiedName v0)+ Syntax.NameNormal v0 -> writeQualifiedName v0)+-- | Convert an import/export specification to an AST expression+namedImportExportToExpr :: Syntax.NamedImportExport -> Ast.Expr+namedImportExportToExpr spec = nameToExpr (Syntax.namedImportExportName spec)+-- | Convert a pattern to an AST expression+patternToExpr :: Syntax.Pattern -> Ast.Expr+patternToExpr pat =+ case pat of+ Syntax.PatternApplication v0 -> applicationPatternToExpr v0+ Syntax.PatternList v0 -> Serialization.bracketList Serialization.halfBlockStyle (Lists.map patternToExpr v0)+ Syntax.PatternLiteral v0 -> literalToExpr v0+ Syntax.PatternName v0 -> nameToExpr v0+ Syntax.PatternTuple v0 -> Serialization.parenListAdaptive (Lists.map patternToExpr v0)+ Syntax.PatternWildcard -> Serialization.cst "_"+-- | Convert a record construction expression to an AST expression+recordExpressionToExpr :: Syntax.RecordExpression -> Ast.Expr+recordExpressionToExpr constructRecord =++ let name = Syntax.recordExpressionName constructRecord+ updates = Syntax.recordExpressionFields constructRecord+ fromUpdate =+ \update ->+ let fn = Syntax.fieldUpdateName update+ val = Syntax.fieldUpdateValue update+ in (Serialization.ifx Operators.defineOp (nameToExpr fn) (expressionToExpr val))+ body = Serialization.commaSep Serialization.halfBlockStyle (Lists.map fromUpdate updates)+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.brackets Serialization.curlyBraces Serialization.halfBlockStyle body]))+-- | Convert a right-hand side to an AST expression+rightHandSideToExpr :: Syntax.RightHandSide -> Ast.Expr+rightHandSideToExpr rhs = expressionToExpr (Syntax.unRightHandSide rhs)+-- | Convert a statement to an AST expression+statementToExpr :: Syntax.Statement -> Ast.Expr+statementToExpr stmt = expressionToExpr (Syntax.unStatement stmt)+-- | Convert a string to Haddock documentation comments. Empty source lines emit `-- |` (no trailing space) so blank doc lines don't carry trailing whitespace into the generated file.+toHaskellComments :: String -> String+toHaskellComments c =+ Strings.intercalate "\n" (Lists.map (\s -> Logic.ifElse (Equality.equal s "") "-- |" (Strings.cat2 "-- | " s)) (Strings.lines c))+-- | Convert a string to simple line comments. Empty source lines emit `--` (no trailing space) for the same reason as toHaskellComments.+toSimpleComments :: String -> String+toSimpleComments c =+ Strings.intercalate "\n" (Lists.map (\s -> Logic.ifElse (Equality.equal s "") "--" (Strings.cat2 "-- " s)) (Strings.lines c))+-- | Convert a type signature to an AST expression+typeSignatureToExpr :: Syntax.TypeSignature -> Ast.Expr+typeSignatureToExpr typeSig =++ let name = Syntax.typeSignatureName typeSig+ typ = Syntax.typeSignatureType typeSig+ nameExpr = nameToExpr name+ typeExpr = typeToExpr typ+ inlineSig =+ Serialization.structuralSpaceSep [+ nameExpr,+ (Serialization.cst "::"),+ typeExpr]+ in (Serialization.chooseLayout Serialization.maxLineWidth inlineSig (Serialization.newlineSep [+ Serialization.spaceSep [+ nameExpr,+ (Serialization.cst "::")],+ (Serialization.tabIndent typeExpr)]))+-- | Convert a Haskell type to an AST expression+typeToExpr :: Syntax.Type -> Ast.Expr+typeToExpr htype =+ case htype of+ Syntax.TypeApplication v0 ->+ let lhs = Syntax.applicationTypeContext v0+ rhs = Syntax.applicationTypeArgument v0+ in (Serialization.ifx Operators.appOp (typeToExpr lhs) (typeToExpr rhs))+ Syntax.TypeCtx v0 ->+ let ctx = Syntax.constrainedTypeCtx v0+ typ = Syntax.constrainedTypeType v0+ in (Serialization.ifx Operators.assertOp (constraintToExpr ctx) (typeToExpr typ))+ Syntax.TypeFunction v0 ->+ let dom = Syntax.functionTypeDomain v0+ cod = Syntax.functionTypeCodomain v0+ in (Serialization.ifx Operators.arrowOp (typeToExpr dom) (typeToExpr cod))+ Syntax.TypeList v0 -> Serialization.bracketList Serialization.inlineStyle [+ typeToExpr v0]+ Syntax.TypeTuple v0 -> Serialization.parenListAdaptive (Lists.map typeToExpr v0)+ Syntax.TypeVariable v0 -> nameToExpr v0+-- | Convert a value binding to an AST expression+valueBindingToExpr :: Syntax.ValueBinding -> Ast.Expr+valueBindingToExpr vb =+ case vb of+ Syntax.ValueBindingSimple v0 ->+ let pat = Syntax.simpleValueBindingPattern v0+ rhs = Syntax.simpleValueBindingRhs v0+ local = Syntax.simpleValueBindingLocalBindings v0+ lhsExpr = patternToExpr pat+ rhsExpr = rightHandSideToExpr rhs+ inlineBody =+ Serialization.structuralSpaceSep [+ lhsExpr,+ (Serialization.cst "="),+ rhsExpr]+ body =+ Serialization.chooseLayout Serialization.maxLineWidth inlineBody (Serialization.newlineSep [+ Serialization.spaceSep [+ lhsExpr,+ (Serialization.cst "=")],+ (Serialization.tabIndent rhsExpr)])+ in (Optionals.cases local body (\localBindings ->+ let bindings = Syntax.unLocalBindings localBindings+ in (Serialization.indentBlock (Lists.cons body [+ Serialization.indentBlock (Lists.cons (Serialization.cst "where") (Lists.map localBindingToExpr bindings))]))))+-- | Convert a type variable to an AST expression+variableToExpr :: Syntax.Variable -> Ast.Expr+variableToExpr variable = nameToExpr (Syntax.unVariable variable)+-- | Write a qualified name as a string+writeQualifiedName :: Syntax.QualifiedName -> String+writeQualifiedName qname =++ let qualifiers = Syntax.qualifiedNameQualifiers qname+ unqual = Syntax.qualifiedNameUnqualified qname+ h = \namePart -> Syntax.unNamePart namePart+ allParts = Lists.concat2 (Lists.map h qualifiers) [+ h unqual]+ in (Strings.intercalate "." allParts)
+ src/main/haskell/Hydra/Haskell/Syntax.hs view
@@ -0,0 +1,770 @@+-- Note: this is an automatically generated file. Do not edit.+-- | A Haskell syntax model for Hydra. Originally inspired by Language.Haskell.Tools.AST, but now diverges freely to suit Hydra's needs.++module Hydra.Haskell.Syntax where+import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | 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)+_Alternative = Core.Name "hydra.haskell.syntax.Alternative"+_Alternative_pattern = Core.Name "pattern"+_Alternative_rhs = Core.Name "rhs"+_Alternative_binds = Core.Name "binds"+-- | A type constraint+data Constraint =+ -- | A class constraint+ ConstraintClass ClassConstraint |+ -- | A tuple of constraints+ ConstraintTuple [Constraint]+ deriving (Eq, Ord, Read, Show)+_Constraint = Core.Name "hydra.haskell.syntax.Constraint"+_Constraint_class = Core.Name "class"+_Constraint_tuple = Core.Name "tuple"+-- | A class constraint+data ClassConstraint =+ ClassConstraint {+ -- | The name of the class+ classConstraintName :: Name,+ -- | The types to which the class is applied+ classConstraintTypes :: [Type]}+ deriving (Eq, Ord, Read, Show)+_ClassConstraint = Core.Name "hydra.haskell.syntax.ClassConstraint"+_ClassConstraint_name = Core.Name "name"+_ClassConstraint_types = Core.Name "types"+-- | The right-hand side of a pattern-matching alternative+newtype CaseRhs =+ CaseRhs {+ unCaseRhs :: Expression}+ deriving (Eq, Ord, Read, Show)+_CaseRhs = Core.Name "hydra.haskell.syntax.CaseRhs"+-- | A data constructor+data Constructor =+ -- | An ordinary (positional) constructor+ ConstructorOrdinary PositionalConstructor |+ -- | A record constructor+ ConstructorRecord RecordConstructor+ deriving (Eq, Ord, Read, Show)+_Constructor = Core.Name "hydra.haskell.syntax.Constructor"+_Constructor_ordinary = Core.Name "ordinary"+_Constructor_record = Core.Name "record"+-- | An ordinary (positional) data constructor+data PositionalConstructor =+ PositionalConstructor {+ -- | The name of the constructor+ positionalConstructorName :: Name,+ -- | The types of the positional fields+ positionalConstructorFields :: [Type],+ -- | Optional comments+ positionalConstructorComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_PositionalConstructor = Core.Name "hydra.haskell.syntax.PositionalConstructor"+_PositionalConstructor_name = Core.Name "name"+_PositionalConstructor_fields = Core.Name "fields"+_PositionalConstructor_comments = Core.Name "comments"+-- | A record-style data constructor+data RecordConstructor =+ RecordConstructor {+ -- | The name of the constructor+ recordConstructorName :: Name,+ -- | The named fields of the record+ recordConstructorFields :: [Field],+ -- | Optional comments+ recordConstructorComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_RecordConstructor = Core.Name "hydra.haskell.syntax.RecordConstructor"+_RecordConstructor_name = Core.Name "name"+_RecordConstructor_fields = Core.Name "fields"+_RecordConstructor_comments = Core.Name "comments"+-- | A data type declaration+data DataDeclaration =+ DataDeclaration {+ -- | The 'data' or 'newtype' keyword+ dataDeclarationKeyword :: DataKeyword,+ -- | Type class constraints+ dataDeclarationContext :: [Constraint],+ -- | The declaration head+ dataDeclarationHead :: DeclarationHead,+ -- | The data constructors+ dataDeclarationConstructors :: [Constructor],+ -- | Derived type class instances+ dataDeclarationDeriving :: [DerivingClause],+ -- | Optional comments+ dataDeclarationComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_DataDeclaration = Core.Name "hydra.haskell.syntax.DataDeclaration"+_DataDeclaration_keyword = Core.Name "keyword"+_DataDeclaration_context = Core.Name "context"+_DataDeclaration_head = Core.Name "head"+_DataDeclaration_constructors = Core.Name "constructors"+_DataDeclaration_deriving = Core.Name "deriving"+_DataDeclaration_comments = Core.Name "comments"+-- | The 'data' versus 'newtype keyword+data DataKeyword =+ DataKeywordData |+ DataKeywordNewtype+ deriving (Eq, Ord, Read, Show)+_DataKeyword = Core.Name "hydra.haskell.syntax.DataKeyword"+_DataKeyword_data = Core.Name "data"+_DataKeyword_newtype = Core.Name "newtype"+-- | A data or value declaration+data Declaration =+ -- | A data type declaration+ DeclarationData DataDeclaration |+ -- | A type synonym declaration+ DeclarationType TypeSynonymDeclaration |+ -- | A value binding+ DeclarationValueBinding ValueBinding |+ -- | A typed binding+ DeclarationTypedBinding TypedBinding+ deriving (Eq, Ord, Read, Show)+_Declaration = Core.Name "hydra.haskell.syntax.Declaration"+_Declaration_data = Core.Name "data"+_Declaration_type = Core.Name "type"+_Declaration_valueBinding = Core.Name "valueBinding"+_Declaration_typedBinding = Core.Name "typedBinding"+-- | The left-hand side of a declaration+data DeclarationHead =+ -- | An application-style declaration head+ DeclarationHeadApplication ApplicationDeclarationHead |+ -- | A simple name+ DeclarationHeadSimple Name+ deriving (Eq, Ord, Read, Show)+_DeclarationHead = Core.Name "hydra.haskell.syntax.DeclarationHead"+_DeclarationHead_application = Core.Name "application"+_DeclarationHead_simple = Core.Name "simple"+-- | 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)+_ApplicationDeclarationHead = Core.Name "hydra.haskell.syntax.ApplicationDeclarationHead"+_ApplicationDeclarationHead_function = Core.Name "function"+_ApplicationDeclarationHead_operand = Core.Name "operand"+-- | A 'deriving' clause+newtype DerivingClause =+ DerivingClause {+ unDerivingClause :: [Name]}+ deriving (Eq, Ord, Read, Show)+_DerivingClause = Core.Name "hydra.haskell.syntax.DerivingClause"+-- | An export statement+data Export =+ -- | An exported declaration+ ExportDeclaration NamedImportExport |+ -- | An exported module+ ExportModule ModuleName+ deriving (Eq, Ord, Read, Show)+_Export = Core.Name "hydra.haskell.syntax.Export"+_Export_declaration = Core.Name "declaration"+_Export_module = Core.Name "module"+-- | A data expression+data Expression =+ -- | A function application+ ExpressionApplication ApplicationExpression |+ -- | A case expression+ ExpressionCase CaseExpression |+ -- | A record constructor expression+ ExpressionConstructRecord RecordExpression |+ -- | A 'do' expression+ ExpressionDo [Statement] |+ -- | An 'if' expression+ ExpressionIf IfExpression |+ -- | An infix application+ ExpressionInfixApplication InfixExpression |+ -- | 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 right section expression+ ExpressionRightSection SectionExpression |+ -- | A tuple expression+ ExpressionTuple [Expression] |+ -- | A type signature expression+ ExpressionTypeSignature TypedExpression |+ -- | A record update expression+ ExpressionUpdateRecord RecordUpdateExpression |+ -- | A variable reference+ ExpressionVariable Name+ deriving (Eq, Ord, Read, Show)+_Expression = Core.Name "hydra.haskell.syntax.Expression"+_Expression_application = Core.Name "application"+_Expression_case = Core.Name "case"+_Expression_constructRecord = Core.Name "constructRecord"+_Expression_do = Core.Name "do"+_Expression_if = Core.Name "if"+_Expression_infixApplication = Core.Name "infixApplication"+_Expression_literal = Core.Name "literal"+_Expression_lambda = Core.Name "lambda"+_Expression_leftSection = Core.Name "leftSection"+_Expression_let = Core.Name "let"+_Expression_list = Core.Name "list"+_Expression_rightSection = Core.Name "rightSection"+_Expression_tuple = Core.Name "tuple"+_Expression_typeSignature = Core.Name "typeSignature"+_Expression_updateRecord = Core.Name "updateRecord"+_Expression_variable = Core.Name "variable"+-- | An application expression+data ApplicationExpression =+ ApplicationExpression {+ -- | The function being applied+ applicationExpressionFunction :: Expression,+ -- | The argument+ applicationExpressionArgument :: Expression}+ deriving (Eq, Ord, Read, Show)+_ApplicationExpression = Core.Name "hydra.haskell.syntax.ApplicationExpression"+_ApplicationExpression_function = Core.Name "function"+_ApplicationExpression_argument = Core.Name "argument"+-- | A case expression+data CaseExpression =+ CaseExpression {+ -- | The expression being matched+ caseExpressionCase :: Expression,+ -- | The pattern-matching alternatives+ caseExpressionAlternatives :: [Alternative]}+ deriving (Eq, Ord, Read, Show)+_CaseExpression = Core.Name "hydra.haskell.syntax.CaseExpression"+_CaseExpression_case = Core.Name "case"+_CaseExpression_alternatives = Core.Name "alternatives"+-- | A record constructor expression+data RecordExpression =+ RecordExpression {+ -- | The constructor name+ recordExpressionName :: Name,+ -- | The field assignments+ recordExpressionFields :: [FieldUpdate]}+ deriving (Eq, Ord, Read, Show)+_RecordExpression = Core.Name "hydra.haskell.syntax.RecordExpression"+_RecordExpression_name = Core.Name "name"+_RecordExpression_fields = Core.Name "fields"+-- | 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)+_IfExpression = Core.Name "hydra.haskell.syntax.IfExpression"+_IfExpression_condition = Core.Name "condition"+_IfExpression_then = Core.Name "then"+_IfExpression_else = Core.Name "else"+-- | An infix application expression+data InfixExpression =+ InfixExpression {+ -- | The left-hand operand+ infixExpressionLhs :: Expression,+ -- | The infix operator+ infixExpressionOperator :: Operator,+ -- | The right-hand operand+ infixExpressionRhs :: Expression}+ deriving (Eq, Ord, Read, Show)+_InfixExpression = Core.Name "hydra.haskell.syntax.InfixExpression"+_InfixExpression_lhs = Core.Name "lhs"+_InfixExpression_operator = Core.Name "operator"+_InfixExpression_rhs = Core.Name "rhs"+-- | A lambda expression+data LambdaExpression =+ LambdaExpression {+ -- | The patterns binding parameters+ lambdaExpressionBindings :: [Pattern],+ -- | The body of the lambda+ lambdaExpressionInner :: Expression}+ deriving (Eq, Ord, Read, Show)+_LambdaExpression = Core.Name "hydra.haskell.syntax.LambdaExpression"+_LambdaExpression_bindings = Core.Name "bindings"+_LambdaExpression_inner = Core.Name "inner"+-- | A 'let' expression+data LetExpression =+ LetExpression {+ -- | The local bindings+ letExpressionBindings :: [LocalBinding],+ -- | The body of the let expression+ letExpressionInner :: Expression}+ deriving (Eq, Ord, Read, Show)+_LetExpression = Core.Name "hydra.haskell.syntax.LetExpression"+_LetExpression_bindings = Core.Name "bindings"+_LetExpression_inner = Core.Name "inner"+-- | A section expression+data SectionExpression =+ SectionExpression {+ -- | The operator+ sectionExpressionOperator :: Operator,+ -- | The operand+ sectionExpressionExpression :: Expression}+ deriving (Eq, Ord, Read, Show)+_SectionExpression = Core.Name "hydra.haskell.syntax.SectionExpression"+_SectionExpression_operator = Core.Name "operator"+_SectionExpression_expression = Core.Name "expression"+-- | A type signature expression+data TypedExpression =+ TypedExpression {+ -- | The expression being typed+ typedExpressionInner :: Expression,+ -- | The type signature+ typedExpressionType :: Type}+ deriving (Eq, Ord, Read, Show)+_TypedExpression = Core.Name "hydra.haskell.syntax.TypedExpression"+_TypedExpression_inner = Core.Name "inner"+_TypedExpression_type = Core.Name "type"+-- | An update record expression+data RecordUpdateExpression =+ RecordUpdateExpression {+ -- | The record being updated+ recordUpdateExpressionInner :: Expression,+ -- | The field updates+ recordUpdateExpressionFields :: [FieldUpdate]}+ deriving (Eq, Ord, Read, Show)+_RecordUpdateExpression = Core.Name "hydra.haskell.syntax.RecordUpdateExpression"+_RecordUpdateExpression_inner = Core.Name "inner"+_RecordUpdateExpression_fields = Core.Name "fields"+-- | A field (name/type pair)+data Field =+ Field {+ -- | The field name+ fieldName :: Name,+ -- | The field type+ fieldType :: Type,+ -- | Optional comments+ fieldComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_Field = Core.Name "hydra.haskell.syntax.Field"+_Field_name = Core.Name "name"+_Field_type = Core.Name "type"+_Field_comments = Core.Name "comments"+-- | A field name and value+data FieldUpdate =+ FieldUpdate {+ -- | The field name+ fieldUpdateName :: Name,+ -- | The field value+ fieldUpdateValue :: Expression}+ deriving (Eq, Ord, Read, Show)+_FieldUpdate = Core.Name "hydra.haskell.syntax.FieldUpdate"+_FieldUpdate_name = Core.Name "name"+_FieldUpdate_value = Core.Name "value"+-- | 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 ImportSpec)}+ deriving (Eq, Ord, Read, Show)+_Import = Core.Name "hydra.haskell.syntax.Import"+_Import_qualified = Core.Name "qualified"+_Import_module = Core.Name "module"+_Import_as = Core.Name "as"+_Import_spec = Core.Name "spec"+-- | An import specification+data ImportSpec =+ -- | A list of imports to include+ ImportSpecList [NamedImportExport] |+ -- | A list of imports to exclude+ ImportSpecHiding [NamedImportExport]+ deriving (Eq, Ord, Read, Show)+_ImportSpec = Core.Name "hydra.haskell.syntax.ImportSpec"+_ImportSpec_list = Core.Name "list"+_ImportSpec_hiding = Core.Name "hiding"+-- | An import modifier ('pattern' or 'type')+data ImportModifier =+ ImportModifierPattern |+ ImportModifierType+ deriving (Eq, Ord, Read, Show)+_ImportModifier = Core.Name "hydra.haskell.syntax.ImportModifier"+_ImportModifier_pattern = Core.Name "pattern"+_ImportModifier_type = Core.Name "type"+-- | An import or export specification+data NamedImportExport =+ NamedImportExport {+ -- | Optional import modifier+ namedImportExportModifier :: (Maybe ImportModifier),+ -- | The name being imported or exported+ namedImportExportName :: Name,+ -- | Optional subspecification+ namedImportExportSubspec :: (Maybe ImportExportSubspec)}+ deriving (Eq, Ord, Read, Show)+_NamedImportExport = Core.Name "hydra.haskell.syntax.NamedImportExport"+_NamedImportExport_modifier = Core.Name "modifier"+_NamedImportExport_name = Core.Name "name"+_NamedImportExport_subspec = Core.Name "subspec"+-- | A subspecification within an import/export+data ImportExportSubspec =+ -- | Import/export all+ ImportExportSubspecAll |+ -- | Import/export specific names+ ImportExportSubspecList [Name]+ deriving (Eq, Ord, Read, Show)+_ImportExportSubspec = Core.Name "hydra.haskell.syntax.ImportExportSubspec"+_ImportExportSubspec_all = Core.Name "all"+_ImportExportSubspec_list = Core.Name "list"+-- | 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)+_Literal = Core.Name "hydra.haskell.syntax.Literal"+_Literal_char = Core.Name "char"+_Literal_double = Core.Name "double"+_Literal_float = Core.Name "float"+_Literal_int = Core.Name "int"+_Literal_integer = Core.Name "integer"+_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)+_LocalBinding = Core.Name "hydra.haskell.syntax.LocalBinding"+_LocalBinding_signature = Core.Name "signature"+_LocalBinding_value = Core.Name "value"+-- | A collection of local bindings+newtype LocalBindings =+ LocalBindings {+ unLocalBindings :: [LocalBinding]}+ deriving (Eq, Ord, Read, Show)+_LocalBindings = Core.Name "hydra.haskell.syntax.LocalBindings"+-- | A Haskell module+data Module =+ Module {+ -- | Optional module head+ moduleHead :: (Maybe ModuleHead),+ -- | Import statements+ moduleImports :: [Import],+ -- | Module declarations+ moduleDeclarations :: [Declaration]}+ deriving (Eq, Ord, Read, Show)+_Module = Core.Name "hydra.haskell.syntax.Module"+_Module_head = Core.Name "head"+_Module_imports = Core.Name "imports"+_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)+_ModuleHead = Core.Name "hydra.haskell.syntax.ModuleHead"+_ModuleHead_comments = Core.Name "comments"+_ModuleHead_name = Core.Name "name"+_ModuleHead_exports = Core.Name "exports"+-- | A module name+newtype ModuleName =+ ModuleName {+ unModuleName :: String}+ deriving (Eq, Ord, Read, Show)+_ModuleName = Core.Name "hydra.haskell.syntax.ModuleName"+-- | A name+data Name =+ -- | An implicit name+ NameImplicit QualifiedName |+ -- | A normal name+ NameNormal QualifiedName+ deriving (Eq, Ord, Read, Show)+_Name = Core.Name "hydra.haskell.syntax.Name"+_Name_implicit = Core.Name "implicit"+_Name_normal = Core.Name "normal"+-- | A component of a qualified name+newtype NamePart =+ NamePart {+ unNamePart :: String}+ deriving (Eq, Ord, Read, Show)+_NamePart = Core.Name "hydra.haskell.syntax.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)+_Operator = Core.Name "hydra.haskell.syntax.Operator"+_Operator_backtick = Core.Name "backtick"+_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 record pattern+ PatternRecord RecordPattern |+ -- | A tuple pattern+ PatternTuple [Pattern] |+ -- | A typed pattern+ PatternTyped TypedPattern |+ -- | A wildcard pattern+ PatternWildcard+ deriving (Eq, Ord, Read, Show)+_Pattern = Core.Name "hydra.haskell.syntax.Pattern"+_Pattern_application = Core.Name "application"+_Pattern_as = Core.Name "as"+_Pattern_list = Core.Name "list"+_Pattern_literal = Core.Name "literal"+_Pattern_name = Core.Name "name"+_Pattern_record = Core.Name "record"+_Pattern_tuple = Core.Name "tuple"+_Pattern_typed = Core.Name "typed"+_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)+_ApplicationPattern = Core.Name "hydra.haskell.syntax.ApplicationPattern"+_ApplicationPattern_name = Core.Name "name"+_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)+_AsPattern = Core.Name "hydra.haskell.syntax.AsPattern"+_AsPattern_name = Core.Name "name"+_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)+_RecordPattern = Core.Name "hydra.haskell.syntax.RecordPattern"+_RecordPattern_name = Core.Name "name"+_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)+_TypedPattern = Core.Name "hydra.haskell.syntax.TypedPattern"+_TypedPattern_inner = Core.Name "inner"+_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)+_PatternField = Core.Name "hydra.haskell.syntax.PatternField"+_PatternField_name = Core.Name "name"+_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)+_QualifiedName = Core.Name "hydra.haskell.syntax.QualifiedName"+_QualifiedName_qualifiers = Core.Name "qualifiers"+_QualifiedName_unqualified = Core.Name "unqualified"+-- | A right-hand side of a binding+newtype RightHandSide =+ RightHandSide {+ unRightHandSide :: Expression}+ deriving (Eq, Ord, Read, Show)+_RightHandSide = Core.Name "hydra.haskell.syntax.RightHandSide"+-- | A do-notation statement+newtype Statement =+ Statement {+ unStatement :: Expression}+ deriving (Eq, Ord, Read, Show)+_Statement = Core.Name "hydra.haskell.syntax.Statement"+-- | A type expression+data Type =+ -- | An application type+ TypeApplication ApplicationType |+ -- | A context type+ TypeCtx ConstrainedType |+ -- | A function type+ TypeFunction FunctionType |+ -- | An infix type+ TypeInfix InfixType |+ -- | A list type+ TypeList Type |+ -- | A tuple type+ TypeTuple [Type] |+ -- | A type variable or type name+ TypeVariable Name+ deriving (Eq, Ord, Read, Show)+_Type = Core.Name "hydra.haskell.syntax.Type"+_Type_application = Core.Name "application"+_Type_ctx = Core.Name "ctx"+_Type_function = Core.Name "function"+_Type_infix = Core.Name "infix"+_Type_list = Core.Name "list"+_Type_tuple = Core.Name "tuple"+_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)+_ApplicationType = Core.Name "hydra.haskell.syntax.ApplicationType"+_ApplicationType_context = Core.Name "context"+_ApplicationType_argument = Core.Name "argument"+-- | A type with a context (type class constraints)+data ConstrainedType =+ ConstrainedType {+ -- | The type class context+ constrainedTypeCtx :: Constraint,+ -- | The constrained type+ constrainedTypeType :: Type}+ deriving (Eq, Ord, Read, Show)+_ConstrainedType = Core.Name "hydra.haskell.syntax.ConstrainedType"+_ConstrainedType_ctx = Core.Name "ctx"+_ConstrainedType_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)+_FunctionType = Core.Name "hydra.haskell.syntax.FunctionType"+_FunctionType_domain = Core.Name "domain"+_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 type+ infixTypeRhs :: Type}+ deriving (Eq, Ord, Read, Show)+_InfixType = Core.Name "hydra.haskell.syntax.InfixType"+_InfixType_lhs = Core.Name "lhs"+_InfixType_operator = Core.Name "operator"+_InfixType_rhs = Core.Name "rhs"+-- | A type synonym declaration+data TypeSynonymDeclaration =+ TypeSynonymDeclaration {+ -- | The declaration head+ typeSynonymDeclarationName :: DeclarationHead,+ -- | The type being defined+ typeSynonymDeclarationType :: Type,+ -- | Optional comments+ typeSynonymDeclarationComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_TypeSynonymDeclaration = Core.Name "hydra.haskell.syntax.TypeSynonymDeclaration"+_TypeSynonymDeclaration_name = Core.Name "name"+_TypeSynonymDeclaration_type = Core.Name "type"+_TypeSynonymDeclaration_comments = Core.Name "comments"+-- | A type signature+data TypeSignature =+ TypeSignature {+ -- | The name being typed+ typeSignatureName :: Name,+ -- | The type+ typeSignatureType :: Type}+ deriving (Eq, Ord, Read, Show)+_TypeSignature = Core.Name "hydra.haskell.syntax.TypeSignature"+_TypeSignature_name = Core.Name "name"+_TypeSignature_type = Core.Name "type"+-- | A binding with its type signature+data TypedBinding =+ TypedBinding {+ -- | The type signature+ typedBindingTypeSignature :: TypeSignature,+ -- | The value binding+ typedBindingValueBinding :: ValueBinding,+ -- | Optional comments+ typedBindingComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_TypedBinding = Core.Name "hydra.haskell.syntax.TypedBinding"+_TypedBinding_typeSignature = Core.Name "typeSignature"+_TypedBinding_valueBinding = Core.Name "valueBinding"+_TypedBinding_comments = Core.Name "comments"+-- | A value binding+data ValueBinding =+ -- | A simple value binding+ ValueBindingSimple SimpleValueBinding+ deriving (Eq, Ord, Read, Show)+_ValueBinding = Core.Name "hydra.haskell.syntax.ValueBinding"+_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),+ -- | Optional comments+ simpleValueBindingComments :: (Maybe String)}+ deriving (Eq, Ord, Read, Show)+_SimpleValueBinding = Core.Name "hydra.haskell.syntax.SimpleValueBinding"+_SimpleValueBinding_pattern = Core.Name "pattern"+_SimpleValueBinding_rhs = Core.Name "rhs"+_SimpleValueBinding_localBindings = Core.Name "localBindings"+_SimpleValueBinding_comments = Core.Name "comments"+-- | A type variable+newtype Variable =+ Variable {+ unVariable :: Name}+ deriving (Eq, Ord, Read, Show)+_Variable = Core.Name "hydra.haskell.syntax.Variable"
+ src/main/haskell/Hydra/Haskell/Testing.hs view
@@ -0,0 +1,220 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Haskell test code generation for HSpec-based generation tests++module Hydra.Haskell.Testing where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Constants as Constants+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as DecodeCore+import qualified Hydra.Dependencies as Dependencies+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Haskell.Syntax as Syntax+import qualified Hydra.Haskell.Utils as Utils+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Haskell.Lib.Eithers as Eithers+import qualified Hydra.Haskell.Lib.Equality as Equality+import qualified Hydra.Haskell.Lib.Lists as Lists+import qualified Hydra.Haskell.Lib.Literals as Literals+import qualified Hydra.Haskell.Lib.Logic as Logic+import qualified Hydra.Haskell.Lib.Maps as Maps+import qualified Hydra.Haskell.Lib.Math as Math+import qualified Hydra.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Haskell.Lib.Sets as Sets+import qualified Hydra.Haskell.Lib.Strings as Strings+import qualified Hydra.Names as Names+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Predicates as Predicates+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Scoping as Scoping+import qualified Hydra.Show.Errors as ShowErrors+import qualified Hydra.Strip as Strip+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Set as S+-- | Add namespaces from a set of names to existing namespaces+addNamespacesToNamespaces :: Util.ModuleNames Syntax.ModuleName -> S.Set Core.Name -> Util.ModuleNames Syntax.ModuleName+addNamespacesToNamespaces ns0 names =++ let newNamespaces = Sets.fromList (Optionals.cat (Lists.map Names.moduleNameOf (Sets.toList names)))+ toModuleName =+ \namespace -> Syntax.ModuleName (Formatting.capitalize (Optionals.fromOptional (Packaging.unModuleName namespace) (Lists.maybeLast (Strings.splitOn "." (Packaging.unModuleName namespace)))))+ newMappings = Maps.fromList (Lists.map (\ns_ -> (ns_, (toModuleName ns_))) (Sets.toList newNamespaces))+ in Util.ModuleNames {+ Util.moduleNamesFocus = (Util.moduleNamesFocus ns0),+ Util.moduleNamesMapping = (Maps.union (Util.moduleNamesMapping ns0) newMappings)}+-- | Build namespaces for a test group including encoded term references+buildNamespacesForTestGroup :: Packaging.Module -> Testing.TestGroup -> Graph.Graph -> Either String (Util.ModuleNames Syntax.ModuleName)+buildNamespacesForTestGroup mod tgroup graph_ =++ let testCases_ = collectTestCases tgroup+ testTerms = Lists.concat (Lists.map extractTestTerms testCases_)+ testBindings =+ Lists.map (\term -> Core.Binding {+ Core.bindingName = (Core.Name "_test_"),+ Core.bindingTerm = term,+ Core.bindingTypeScheme = Nothing}) testTerms+ tempModule =+ Packaging.Module {+ Packaging.moduleName = (Packaging.moduleName mod),+ Packaging.moduleMetadata = (Packaging.moduleMetadata mod),+ Packaging.moduleDependencies = (Packaging.moduleDependencies mod),+ Packaging.moduleDefinitions = (Lists.map (\b -> Packaging.DefinitionTerm (Packaging.TermDefinition {+ Packaging.termDefinitionName = (Core.bindingName b),+ Packaging.termDefinitionMetadata = Nothing,+ Packaging.termDefinitionSignature = (Optionals.map Scoping.typeSchemeToTermSignature (Core.bindingTypeScheme b)),+ Packaging.termDefinitionBody = (Core.bindingTerm b)})) testBindings)}+ in (Eithers.bind (Eithers.bimap (\e -> ShowErrors.error e) (\a -> a) (Utils.namespacesForModule tempModule Lexical.emptyInferenceContext graph_)) (\baseNamespaces ->+ let encodedNames = Sets.unions (Lists.map (\t -> extractEncodedTermVariableNames graph_ t) testTerms)+ in (Right (addNamespacesToNamespaces baseNamespaces encodedNames))))+-- | Build the complete test module for Haskell HSpec+buildTestModule :: Packaging.Module -> Testing.TestGroup -> String -> Util.ModuleNames Syntax.ModuleName -> String+buildTestModule testModule testGroup testBody namespaces =++ let ns_ = Packaging.moduleName testModule+ specNs = Packaging.ModuleName (Strings.cat2 (Packaging.unModuleName ns_) "Spec")+ moduleNameString = namespaceToModuleName specNs+ groupName_ = Testing.testGroupName testGroup+ domainImports = findHaskellImports namespaces Sets.empty+ 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 = Lists.concat2 standardImports domainImports+ header =+ Strings.intercalate "\n" (Lists.concat [+ [+ Strings.cat2 "-- " Constants.warningAutoGeneratedFile,+ ""],+ [+ "",+ (Strings.cat [+ "module ",+ moduleNameString,+ " where"]),+ ""],+ allImports,+ [+ "",+ "spec :: H.Spec",+ (Strings.cat [+ "spec = H.describe ",+ (Literals.showString groupName_),+ " $ do"])]])+ in (Strings.cat [+ header,+ "\n",+ testBody,+ "\n"])+-- | Collect variable names from encoded terms within a single term node+collectNames :: Graph.Graph -> S.Set Core.Name -> Core.Term -> S.Set Core.Name+collectNames graf names t =+ Logic.ifElse (Predicates.isEncodedTerm (Strip.deannotateTerm t)) (Eithers.either (\_ -> names) (\decodedTerm -> Sets.union names (Dependencies.termDependencyNames True True True decodedTerm)) (Eithers.bimap (\_e -> _e) (\_a -> _a) (DecodeCore.term graf t))) names+-- | Collect all test cases from a test group recursively+collectTestCases :: Testing.TestGroup -> [Testing.TestCaseWithMetadata]+collectTestCases tg =+ Lists.concat2 (Testing.testGroupCases tg) (Lists.concat (Lists.map collectTestCases (Testing.testGroupSubgroups tg)))+-- | Extract all variable names from term-encoded terms in a given term+extractEncodedTermVariableNames :: Graph.Graph -> Core.Term -> S.Set Core.Name+extractEncodedTermVariableNames graf term =+ Rewriting.foldOverTerm Coders.TraversalOrderPre (collectNames graf) Sets.empty term+-- | Extract input and output terms from a test case+extractTestTerms :: t0 -> [t1]+extractTestTerms tcm = []+-- | Find necessary imports for Haskell based on referenced names+findHaskellImports :: Util.ModuleNames Syntax.ModuleName -> t0 -> [String]+findHaskellImports namespaces names_ =++ let mapping_ = Util.moduleNamesMapping namespaces+ filtered =+ Maps.filterWithKey (\ns_ -> \_v -> Logic.not (Equality.equal (Optionals.fromOptional "" (Lists.maybeHead (Strings.splitOn "hydra.test." (Packaging.unModuleName ns_)))) "")) mapping_+ in (Lists.map (\entry -> Strings.cat [+ "import qualified ",+ (Strings.intercalate "." (Lists.map Formatting.capitalize (Strings.splitOn "." (Packaging.unModuleName (Pairs.first entry))))),+ " as ",+ (Syntax.unModuleName (Pairs.second entry))]) (Maps.toList filtered))+-- | Generate a Haskell test file for a test group, with type inference and namespace building+generateHaskellTestFile :: Packaging.Module -> Testing.TestGroup -> Graph.Graph -> Either String (String, String)+generateHaskellTestFile testModule testGroup g =+ Eithers.bind (buildNamespacesForTestGroup testModule testGroup g) (\namespaces -> generateTestFile testModule testGroup namespaces)+-- | Generate a single HSpec test case from a universal test case+generateTestCase :: t0 -> Testing.TestCaseWithMetadata -> Either t1 [String]+generateTestCase depth tcm =++ let name_ = Testing.testCaseWithMetadataName tcm+ tcase = Testing.testCaseWithMetadataCase tcm+ universal =+ case tcase of+ Testing.TestCaseUniversal v0 -> v0+ actual_ = Testing.universalTestCaseActual universal ()+ expected_ = Testing.universalTestCaseExpected universal ()+ in (Right [+ Strings.cat [+ "H.it ",+ (Literals.showString name_),+ " $ H.shouldBe"],+ (Strings.cat [+ " (",+ actual_,+ ")"]),+ (Strings.cat [+ " (",+ expected_,+ ")"])])+-- | Generate a complete Haskell test file+generateTestFile :: Packaging.Module -> Testing.TestGroup -> Util.ModuleNames Syntax.ModuleName -> Either t0 (String, String)+generateTestFile testModule testGroup namespaces =+ Eithers.map (\testBody ->+ let testModuleContent = buildTestModule testModule testGroup testBody namespaces+ ns_ = Packaging.moduleName testModule+ specNs = Packaging.ModuleName (Strings.cat2 (Packaging.unModuleName ns_) "Spec")+ filePath = Names.moduleNameToFilePath Util.CaseConventionPascal (Util.FileExtension "hs") specNs+ in (filePath, testModuleContent)) (generateTestGroupHierarchy 1 testGroup)+-- | Generate test hierarchy preserving the structure with H.describe blocks for subgroups+generateTestGroupHierarchy :: Int -> Testing.TestGroup -> Either t0 String+generateTestGroupHierarchy depth testGroup =++ let cases_ = Testing.testGroupCases testGroup+ subgroups = Testing.testGroupSubgroups testGroup+ indent = Strings.fromList (Lists.replicate (Math.mul depth 2) 32)+ in (Eithers.bind (Eithers.mapList (\tc -> generateTestCase depth tc) cases_) (\testCaseLinesRaw ->+ let testCaseLines = Lists.map (\lines_ -> Lists.map (\line -> Strings.cat2 indent line) lines_) testCaseLinesRaw+ testCasesStr = Strings.intercalate "\n" (Lists.concat testCaseLines)+ in (Eithers.map (\subgroupsStr -> Strings.cat [+ testCasesStr,+ (Logic.ifElse (Logic.or (Equality.equal testCasesStr "") (Equality.equal subgroupsStr "")) "" "\n"),+ subgroupsStr]) (Eithers.map (\blocks -> Strings.intercalate "\n" blocks) (Eithers.mapList (\subgroup ->+ let groupName_ = Testing.testGroupName subgroup+ in (Eithers.map (\content -> Strings.cat [+ indent,+ "H.describe ",+ (Literals.showString groupName_),+ " $ do\n",+ content]) (generateTestGroupHierarchy (Math.add depth 1) subgroup))) subgroups)))))+-- | Convert namespace to Haskell module name+namespaceToModuleName :: Packaging.ModuleName -> String+namespaceToModuleName ns_ =+ Strings.intercalate "." (Lists.map Formatting.capitalize (Strings.splitOn "." (Packaging.unModuleName ns_)))
+ src/main/haskell/Hydra/Haskell/Utils.hs view
@@ -0,0 +1,259 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Utilities for working with Haskell syntax trees++module Hydra.Haskell.Utils where+import qualified Hydra.Analysis as Analysis+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Haskell.Language as Language+import qualified Hydra.Haskell.Syntax as Syntax+import qualified Hydra.Json.Model as Model+import qualified Hydra.Haskell.Lib.Eithers as Eithers+import qualified Hydra.Haskell.Lib.Equality as Equality+import qualified Hydra.Haskell.Lib.Lists as Lists+import qualified Hydra.Haskell.Lib.Logic as Logic+import qualified Hydra.Haskell.Lib.Maps as Maps+import qualified Hydra.Haskell.Lib.Math as Math+import qualified Hydra.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Haskell.Lib.Sets as Sets+import qualified Hydra.Haskell.Lib.Strings as Strings+import qualified Hydra.Names as Names+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Strip as Strip+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Set as S+-- | Create an application pattern from a name and argument patterns+applicationPattern :: Syntax.Name -> [Syntax.Pattern] -> Syntax.Pattern+applicationPattern name args =+ Syntax.PatternApplication (Syntax.ApplicationPattern {+ Syntax.applicationPatternName = name,+ Syntax.applicationPatternArgs = args})+-- | Generate a Haskell name reference for a Hydra element+elementReference :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Syntax.Name+elementReference namespaces name =++ let namespacePair = Util.moduleNamesFocus namespaces+ gname = Pairs.first namespacePair+ gmod = Syntax.unModuleName (Pairs.second namespacePair)+ namespacesMap = Util.moduleNamesMapping namespaces+ qname = Names.qualifyName name+ local = Util.qualifiedNameLocal qname+ escLocal = sanitizeHaskellName local+ mns = Util.qualifiedNameModuleName qname+ in (Optionals.cases (Util.qualifiedNameModuleName qname) (simpleName local) (\ns -> Optionals.cases (Maps.lookup ns namespacesMap) (simpleName local) (\mn ->+ let aliasStr = Syntax.unModuleName mn+ in (Logic.ifElse (Equality.equal ns gname) (simpleName escLocal) (rawName (Strings.cat [+ aliasStr,+ ".",+ (sanitizeHaskellName local)]))))))+-- | Create a Haskell function application expression+hsapp :: Syntax.Expression -> Syntax.Expression -> Syntax.Expression+hsapp l r =+ Syntax.ExpressionApplication (Syntax.ApplicationExpression {+ Syntax.applicationExpressionFunction = l,+ Syntax.applicationExpressionArgument = r})+-- | Create a Haskell lambda expression+hslambda :: Syntax.Name -> Syntax.Expression -> Syntax.Expression+hslambda name rhs =+ Syntax.ExpressionLambda (Syntax.LambdaExpression {+ Syntax.lambdaExpressionBindings = [+ Syntax.PatternName name],+ Syntax.lambdaExpressionInner = rhs})+-- | Create a Haskell literal expression+hslit :: Syntax.Literal -> Syntax.Expression+hslit lit = Syntax.ExpressionLiteral lit+-- | Create a Haskell variable expression from a string+hsvar :: String -> Syntax.Expression+hsvar s = Syntax.ExpressionVariable (rawName s)+-- | Compute the Haskell module namespaces for a Hydra module+namespacesForModule :: Packaging.Module -> t0 -> Graph.Graph -> Either Errors.Error (Util.ModuleNames Syntax.ModuleName)+namespacesForModule mod cx g =+ Eithers.bind (Analysis.moduleDependencyModuleNames cx g True True True True mod) (\termNss ->+ let knownNss =+ Sets.fromList (Optionals.cat (Lists.map Names.moduleNameOf (Lists.concat2 (Maps.keys (Graph.graphSchemaTypes g)) (Maps.keys (Graph.graphBoundTerms g)))))+ rawDeclaredNss = Sets.fromList (Lists.map (\dep -> Packaging.moduleDependencyModule dep) (Packaging.moduleDependencies mod))+ declaredNss = Sets.fromList (Lists.filter (\ns -> Sets.member ns knownNss) (Sets.toList rawDeclaredNss))+ ownNs = Packaging.moduleName mod+ nss = Sets.delete ownNs (Sets.union termNss declaredNss)+ ns = ownNs+ segmentsOf = \namespace -> Strings.splitOn "." (Packaging.unModuleName namespace)+ aliasFromSuffix =+ \segs -> \n ->+ let dropCount = Math.sub (Lists.length segs) n+ suffix = Lists.drop dropCount segs+ capitalizedSuffix = Lists.map Formatting.capitalize suffix+ in (Syntax.ModuleName (Strings.cat capitalizedSuffix))+ toModuleName = \namespace -> aliasFromSuffix (segmentsOf namespace) 1+ focusPair = (ns, (toModuleName ns))+ nssAsList = Sets.toList nss+ segsMap = Maps.fromList (Lists.map (\nm -> (nm, (segmentsOf nm))) nssAsList)+ maxSegs =+ Lists.foldl (\a -> \b -> Logic.ifElse (Equality.gt a b) a b) 1 (Lists.map (\nm -> Lists.length (segmentsOf nm)) nssAsList)+ initialState = Maps.fromList (Lists.map (\nm -> (nm, 1)) nssAsList)+ segsFor = \nm -> Optionals.fromOptional [] (Maps.lookup nm segsMap)+ takenFor = \state -> \nm -> Optionals.fromOptional 1 (Maps.lookup nm state)+ growStep =+ \state -> \_ign ->+ let aliasEntries =+ Lists.map (\nm ->+ let segs = segsFor nm+ n = takenFor state nm+ segCount = Lists.length segs+ aliasStr = Syntax.unModuleName (aliasFromSuffix segs n)+ in (nm, (n, (segCount, aliasStr)))) nssAsList+ aliasCounts =+ Lists.foldl (\m -> \e ->+ let k = Pairs.second (Pairs.second (Pairs.second e))+ in (Maps.insert k (Math.add 1 (Optionals.fromOptional 0 (Maps.lookup k m))) m)) Maps.empty aliasEntries+ aliasMinSegs =+ Lists.foldl (\m -> \e ->+ let segCount = Pairs.first (Pairs.second (Pairs.second e))+ k = Pairs.second (Pairs.second (Pairs.second e))+ existing = Maps.lookup k m+ in (Maps.insert k (Optionals.cases existing segCount (\prev -> Logic.ifElse (Equality.lt segCount prev) segCount prev)) m)) Maps.empty aliasEntries+ aliasMinSegsCount =+ Lists.foldl (\m -> \e ->+ let segCount = Pairs.first (Pairs.second (Pairs.second e))+ k = Pairs.second (Pairs.second (Pairs.second e))+ minSegs = Optionals.fromOptional segCount (Maps.lookup k aliasMinSegs)+ in (Logic.ifElse (Equality.equal segCount minSegs) (Maps.insert k (Math.add 1 (Optionals.fromOptional 0 (Maps.lookup k m))) m) m)) Maps.empty aliasEntries+ in (Maps.fromList (Lists.map (\e ->+ let nm = Pairs.first e+ n = Pairs.first (Pairs.second e)+ segCount = Pairs.first (Pairs.second (Pairs.second e))+ aliasStr = Pairs.second (Pairs.second (Pairs.second e))+ count = Optionals.fromOptional 0 (Maps.lookup aliasStr aliasCounts)+ minSegs = Optionals.fromOptional segCount (Maps.lookup aliasStr aliasMinSegs)+ minSegsCount = Optionals.fromOptional 0 (Maps.lookup aliasStr aliasMinSegsCount)+ canGrow =+ Logic.and (Equality.gt count 1) (Logic.and (Equality.gt segCount n) (Logic.or (Equality.gt segCount minSegs) (Equality.gt minSegsCount 1)))+ newN = Logic.ifElse canGrow (Math.add n 1) n+ in (nm, newN)) aliasEntries))+ finalState = Lists.foldl growStep initialState (Lists.replicate maxSegs ())+ resultMap = Maps.fromList (Lists.map (\nm -> (nm, (aliasFromSuffix (segsFor nm) (takenFor finalState nm)))) nssAsList)+ in (Right (Util.ModuleNames {+ Util.moduleNamesFocus = focusPair,+ Util.moduleNamesMapping = 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 -> Syntax.Name+rawName n =+ Syntax.NameNormal (Syntax.QualifiedName {+ Syntax.qualifiedNameQualifiers = [],+ Syntax.qualifiedNameUnqualified = (Syntax.NamePart n)})+-- | Generate a Haskell name for a record field accessor+recordFieldReference :: Util.ModuleNames Syntax.ModuleName -> Core.Name -> Core.Name -> Syntax.Name+recordFieldReference namespaces sname fname =++ let fnameStr = Core.unName fname+ qname = Names.qualifyName sname+ ns = Util.qualifiedNameModuleName qname+ typeNameStr = typeNameForRecord sname+ decapitalized = Formatting.decapitalize typeNameStr+ capitalized = Formatting.capitalize fnameStr+ nm = Strings.cat2 decapitalized capitalized+ qualName =+ Util.QualifiedName {+ Util.qualifiedNameModuleName = ns,+ Util.qualifiedNameLocal = nm}+ 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 -> Syntax.Name+simpleName arg_ = rawName (sanitizeHaskellName arg_)+-- | Create a simple value binding (e.g., 'foo = expr' or 'foo = expr where ...')+simpleValueBinding :: Syntax.Name -> Syntax.Expression -> Maybe Syntax.LocalBindings -> Syntax.ValueBinding+simpleValueBinding hname rhs bindings =++ let pat =+ Syntax.PatternApplication (Syntax.ApplicationPattern {+ Syntax.applicationPatternName = hname,+ Syntax.applicationPatternArgs = []})+ rightHandSide = Syntax.RightHandSide rhs+ in (Syntax.ValueBindingSimple (Syntax.SimpleValueBinding {+ Syntax.simpleValueBindingPattern = pat,+ Syntax.simpleValueBindingRhs = rightHandSide,+ Syntax.simpleValueBindingLocalBindings = bindings,+ Syntax.simpleValueBindingComments = Nothing}))+-- | Convert a list of types into a nested type application+toTypeApplication :: [Syntax.Type] -> Syntax.Type+toTypeApplication types =++ let dummyType =+ Syntax.TypeVariable (Syntax.NameNormal (Syntax.QualifiedName {+ Syntax.qualifiedNameQualifiers = [],+ Syntax.qualifiedNameUnqualified = (Syntax.NamePart "")}))+ app =+ \l -> Optionals.fromOptional dummyType (Optionals.map (\p -> Logic.ifElse (Lists.null (Pairs.second p)) (Pairs.first p) (Syntax.TypeApplication (Syntax.ApplicationType {+ Syntax.applicationTypeContext = (app (Pairs.second p)),+ Syntax.applicationTypeArgument = (Pairs.first p)}))) (Lists.uncons 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 (Optionals.fromOptional snameStr (Lists.maybeLast parts))+-- | Generate a Haskell name for a union variant constructor, with disambiguation+unionFieldReference :: S.Set Core.Name -> Util.ModuleNames Syntax.ModuleName -> Core.Name -> Core.Name -> Syntax.Name+unionFieldReference boundNames namespaces sname fname =++ let fnameStr = Core.unName fname+ qname = Names.qualifyName sname+ ns = Util.qualifiedNameModuleName qname+ typeNameStr = typeNameForRecord sname+ capitalizedTypeName = Formatting.capitalize typeNameStr+ capitalizedFieldName = Formatting.capitalize fnameStr+ deconflict =+ \name ->+ let tname =+ Names.unqualifyName (Util.QualifiedName {+ Util.qualifiedNameModuleName = ns,+ Util.qualifiedNameLocal = name})+ in (Logic.ifElse (Sets.member tname boundNames) (deconflict (Strings.cat2 name "_")) name)+ nm = deconflict (Strings.cat2 capitalizedTypeName capitalizedFieldName)+ qualName =+ Util.QualifiedName {+ Util.qualifiedNameModuleName = ns,+ Util.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 :: Core.Type -> ([Core.Name], Core.Type)+unpackForallType t =+ case (Strip.deannotateType t) of+ Core.TypeForall v0 ->+ let v = Core.forallTypeParameter v0+ tbody = Core.forallTypeBody v0+ recursiveResult = unpackForallType tbody+ vars = Pairs.first recursiveResult+ finalType = Pairs.second recursiveResult+ in (Lists.cons v vars, finalType)+ _ -> ([], t)