hydra-pg 0.17.5 → 0.17.6
raw patch · 42 files changed
+296/−123 lines, 42 filesdep ~hydra-kerneldep ~hydra-rdfPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: hydra-kernel, hydra-rdf
API changes (from Hackage documentation)
- Hydra.Graphviz.Coder: termToSubtermDotGraph :: Term -> Graph
- Hydra.Graphviz.Coder: termToSubtermDotStmts :: Map ModuleName String -> Term -> [Stmt]
+ Hydra.Graphviz.Coder: graphToSubtermDotGraph :: Graph -> Graph
+ Hydra.Graphviz.Coder: graphToSubtermDotStmts :: Map ModuleName String -> Graph -> [Stmt]
Files
- CHANGELOG.md +162/−0
- hydra-pg.cabal +4/−4
- src/main/haskell/Com/Gdblab/PathAlgebra/Expressions.hs +1/−1
- src/main/haskell/Com/Gdblab/PathAlgebra/Syntax.hs +1/−1
- src/main/haskell/Hydra/Cypher/Features.hs +1/−1
- src/main/haskell/Hydra/Cypher/OpenCypher.hs +1/−1
- src/main/haskell/Hydra/Decode/Neo4j/Model.hs +1/−1
- src/main/haskell/Hydra/Decode/Pg/Mapping.hs +1/−1
- src/main/haskell/Hydra/Decode/Pg/Model.hs +1/−1
- src/main/haskell/Hydra/Demos/Genpg/Transform.hs +9/−9
- src/main/haskell/Hydra/Dsl/Pg/Model.hs +1/−2
- src/main/haskell/Hydra/Encode/Neo4j/Model.hs +1/−1
- src/main/haskell/Hydra/Encode/Pg/Mapping.hs +1/−1
- src/main/haskell/Hydra/Encode/Pg/Model.hs +1/−1
- src/main/haskell/Hydra/Error/Neo4j.hs +1/−1
- src/main/haskell/Hydra/Error/Pg.hs +1/−1
- src/main/haskell/Hydra/Graphviz/Coder.hs +59/−47
- src/main/haskell/Hydra/Graphviz/Dot.hs +1/−1
- src/main/haskell/Hydra/Graphviz/Serde.hs +5/−5
- src/main/haskell/Hydra/Neo4j/Model.hs +1/−1
- src/main/haskell/Hydra/Neo4j/Pg.hs +1/−1
- src/main/haskell/Hydra/Pg/Coder.hs +2/−2
- src/main/haskell/Hydra/Pg/Graphson/Coder.hs +5/−5
- src/main/haskell/Hydra/Pg/Graphson/Construct.hs +2/−2
- src/main/haskell/Hydra/Pg/Graphson/Syntax.hs +1/−1
- src/main/haskell/Hydra/Pg/Graphson/Utils.hs +1/−1
- src/main/haskell/Hydra/Pg/Mapping.hs +1/−1
- src/main/haskell/Hydra/Pg/Model.hs +1/−1
- src/main/haskell/Hydra/Pg/Printing.hs +1/−1
- src/main/haskell/Hydra/Pg/Query.hs +1/−1
- src/main/haskell/Hydra/Pg/Rdf/Environment.hs +1/−1
- src/main/haskell/Hydra/Pg/Rdf/Mappings.hs +1/−1
- src/main/haskell/Hydra/Pg/TermsToElements.hs +6/−6
- src/main/haskell/Hydra/Pg/Utils.hs +3/−3
- src/main/haskell/Hydra/Print/Error/Pg.hs +1/−1
- src/main/haskell/Hydra/Tinkerpop/Examples/Modern.hs +1/−1
- src/main/haskell/Hydra/Tinkerpop/Features.hs +1/−1
- src/main/haskell/Hydra/Tinkerpop/Gremlin.hs +1/−1
- src/main/haskell/Hydra/Tinkerpop/Language.hs +5/−5
- src/main/haskell/Hydra/Validate/Neo4j.hs +4/−4
- src/main/haskell/Hydra/Validate/Pg.hs +1/−1
- src/main/haskell/OpenGql/Grammar.hs +1/−1
CHANGELOG.md view
@@ -15,6 +15,168 @@ --- +## [0.17.6] - 2026-08-30++Point release on the 0.17.x line, and the last backward-incompatible batch before the 1.0 surface+freeze. Five kernel-surface changes land together as the "0.17 breaking batch":+`null` becomes `isEmpty`, `read*`/`show*` become `parse*`/`print*`, `TypeScheme.constraints` and+`TypeVariableConstraints.classes` change shape, and the constructor primitives are finalized.+Alongside them, a genuine soundness gap in type inference is fixed — class constraints now propagate+through function-domain positions — and the cold-seed path is rebuilt on the Java host so that+breaking core-type changes are no longer structurally impossible to bootstrap.++**Backward-incompatible.** All five surface changes below alter the published kernel. Code written+against 0.17.5 must be updated:++- **[#682]** `hydra.lib.{lists,sets,maps,strings}.null` -> `.isEmpty`.+- **[#691]** the `read*`/`show*` family -> `parse*`/`print*`.+- **[#683]** `TypeScheme.constraints`: `optional<map>` -> plain `map`.+- **[#685]** `TypeVariableConstraints.classes`: `list` -> `set`.+- **[#687]** constructor primitives finalized: `lists.pure` is removed; `optionals.given`,+ `eithers.left`/`right` and `pairs.pair` are added.++[#682]: https://github.com/CategoricalData/hydra/issues/682+[#683]: https://github.com/CategoricalData/hydra/issues/683+[#685]: https://github.com/CategoricalData/hydra/issues/685+[#687]: https://github.com/CategoricalData/hydra/issues/687+[#691]: https://github.com/CategoricalData/hydra/issues/691++### Highlights++- **Class constraints propagate through contravariant positions**+ ([#702](https://github.com/CategoricalData/hydra/issues/702)): inference silently dropped a class+ constraint when the constrained type variable was bound through the **domain** (input) position of a+ higher-order function argument, while transferring it correctly in output positions — a real soundness+ gap in the type checker. It had been papered over twice by freezing `encodeMap`/`encodeSet` to+ monomorphic `Int`. Both freezes and the [#554](https://github.com/CategoricalData/hydra/issues/554)+ `toPrimitive` stopgap are now removed, the definitions re-polymorphized, and a domain-position+ regression test added. A `sets.filter` overlay lands across Java, Python, Scala, TypeScript and the+ Lisp dialects as its first consumer.+- **Cold-seed rebuilt on the Java host**+ ([#703](https://github.com/CategoricalData/hydra/issues/703)): CI's cold-seed steps compiled HEAD's+ kernel `Types` source against the *published* Hackage `hydra-kernel`, which is sound only for additive+ changes and structurally impossible for any breaking core-type-shape change — the root of a recurring+ red-CI class (#500, #608, #617, #417, #683). The Haskell cold-seeder (`ColdSeedMain`, `typesmods/`,+ Check-2) is deleted and replaced by a data-driven Java-host schema-walking seed+ (`seed-dist-haskell.sh`), which decodes `dist/json` and emits Haskell text without ever linking+ HEAD types against a published kernel.+- **`hydra.paths` completed** ([#716](https://github.com/CategoricalData/hydra/issues/716)):+ the step unions are realigned with the `hydra.core` term and type grammars — missing variants+ added (`annotatedAnnotation`, `eitherLeft`/`eitherRight`, `effect`), undirected steps given a+ direction, and variants named after retired constructors renamed. `hydra.print.paths` is rewritten+ as serialization-only (printers, parsers and a round-trip law), and the graph view moves to a new+ `hydra.shredding` module (`shredGraph`/`shredTerm`/`shredSchema`), which the Graphviz coder now+ consumes.+- **`hydra.lib.ordering` is genuinely structural on every host**+ ([#718](https://github.com/CategoricalData/hydra/issues/718)): the Java, Python and Scala overlay+ implementations fell back to comparing *printed strings* for non-literal and mixed-variant terms,+ contradicting the normative `ordering-and-equality.md` (records field-by-field in declaration+ order, unions by declared-variant order then payload, wrappers by wrapped value, decimals by+ numeric value then scale — with no print-based fallback anywhere). All three are now structural;+ Java delegates to the generated `compareTo`.+- **Bash driver-layer audit** ([#714](https://github.com/CategoricalData/hydra/issues/714)):+ a prerequisite to the remaining #416 promotion. Six dead build scripts superseded by+ `transform-json-to-target.sh` are deleted, and the #608 oil-and-water and #540 header-idempotency+ regression harnesses are wired into `test-regressions.sh`.++- **Backward-compatibility and deprecation policy**+ ([#676](https://github.com/CategoricalData/hydra/issues/676)): adds the normative spec chapter defining+ what "compatible" means after 1.0 — the additivity calculus, the deprecation/rename mechanism, and+ enforcement. `LifecycleInfo.deprecatedSince` moves from defined-but-unused to populated on **32**+ kernel primitives slated for 0.18 deprecation, via a new `deprecatedSince` DSL helper.+- **Effect-sequencing contract specified and tested**+ ([#675](https://github.com/CategoricalData/hydra/issues/675)): `hydra.lib.effects` carries a sequencing+ contract — effects composed in a specified order, exactly once each, with `bind`'s continuation deferred+ until the prior effect has run. On the lazy Haskell host this falls out of the evaluation model; on the+ eight eager hosts it depended entirely on each hand-written interpreter. The obligations are now written+ into `effects.md` and backed by ordering-observation tests for `bind`/`foldList`/`mapList`/`mapOptional`.+- **Non-GC memory-discipline investigation**+ ([#678](https://github.com/CategoricalData/hydra/issues/678)): Hydra's data model says nothing about+ allocation, freeing, or ownership, which is what gates Swift, Rust, C++ and C as runtime hosts. This+ investigation delivers per-language verdicts plus leak-free proof-of-concept implementations — Rust+ (`Box` structural ownership), C++ (`unique_ptr` + arena) and C (arena), all ASan/LSan-clean on+ construct-and-drop of a recursive `Term` — and an airtight analysis of Swift's class-forcing requirement.+- **Build system promotion continues** ([#416](https://github.com/CategoricalData/hydra/issues/416)):+ adds `hydra.build.Registry`, which models per-language build identity as data (name / coder package /+ family) with per-script scope lists. `syncMatrix` and `langExpansion` are rewired onto it, and the+ hardcoded language lists in the test and bench scripts are retired in favour of a generated+ `languages.json`. Later in the cycle: `publishsets.reverseDepClosure` and+ `publishsets.requiresCoders` promote reverse-dependency propagation and per-package coder-loading+ into data, an `expected-libraries.json` artifact lets the Common Lisp and Emacs Lisp harnesses+ fail fast on a missing `hydra.lib`, and a host-independent `apply-assembly-plan.sh` executor+ (with a conformance test) takes over the Java `assemble-distribution` Step 0.+- **Serialization specification chapter**+ ([#674](https://github.com/CategoricalData/hydra/issues/674)): documents serializability, the+ encode/decode contract, and the round-trip law; `isSerializable` now forbids `void`+ ([#690](https://github.com/CategoricalData/hydra/issues/690)), and `hydra.lib.functions.absurd` is added+ as the void eliminator ([#684](https://github.com/CategoricalData/hydra/issues/684)).++### Bug fixes++- **Hoisting silently produced terms with free variables**+ ([#717](https://github.com/CategoricalData/hydra/issues/717)):+ `augmentBindingsWithNewFreeVars` returned a binding *unchanged* when a captured variable had no+ type in the context, yielding a top-level binding with free variables — a term valid before+ hoisting and invalid after, produced with no error. It is now total and fails loudly, per the+ kernel's fail-immediately rule.+- **TypeScript `div`/`mod` used truncating semantics**+ ([#677](https://github.com/CategoricalData/hydra/issues/677)): corrected to floor/Knuth division via+ shared bigint helpers, with an `Optional` codomain; the dead `maybeDiv`/`maybeMod` are deleted and an+ emitted-path test added.+- **Overlay lag behind the `null` -> `isEmpty` rename**+ ([#682](https://github.com/CategoricalData/hydra/issues/682)): the Java, Python, Scala, TypeScript and+ Lisp overlays each kept a stale spelling (`isEmpty_`, a half-renamed Python `null` impl, and Lisp+ camelCase where the coder emits snake_case), breaking generation until reconciled.+- **`check-haskell-def-completeness` could not resolve qualified assembly references**+ ([#683](https://github.com/CategoricalData/hydra/issues/683)), surfaced once the #703 cold-clone path+ began reaching the check.+- **Void-typed definitions leaked into DSL-ref generation**+ ([#684](https://github.com/CategoricalData/hydra/issues/684)): `absurd` and friends are now excluded+ across all hosts.+- **Scheme bootstrap loader gaps** ([#641](https://github.com/CategoricalData/hydra/issues/641)):+ missing `functions.scm`/`ordering.scm` in the native-lib load list, missing defaults in the def-module+ load list, and a guile-only import allowlist.+- **Bootstrap diff detail was swallowed** ([#671](https://github.com/CategoricalData/hydra/issues/671)):+ now persisted to `<run>/<path>.diff`, with `compare_output`'s return value no longer discarded.+ Separately, `compare_output` mis-derived the `src/main` vs `src/test` root per file+ ([#706](https://github.com/CategoricalData/hydra/issues/706)).+- **Nested duplicate output path** ([#664](https://github.com/CategoricalData/hydra/issues/664)) from+ `hydra-kernel` being hardcoded into `defaultOutput`.+- **Bootstrap codegen exceptions hid their stack traces**+ ([#707](https://github.com/CategoricalData/hydra/issues/707)) in `bootstrap.ts`.++### Release tooling++- `bin/check-release-env.sh` ([#704](https://github.com/CategoricalData/hydra/issues/704)) adds a+ publish-time toolchain preflight, after JDK- and twine-version problems cost real time at 0.17.5.+- The TypeScript head's node floor is lowered to `^18.0.0 || >=20.0.0`, the true vitest constraint+ ([#708](https://github.com/CategoricalData/hydra/issues/708)).+- Hydra does not create GitHub Releases; the detached `.asc` signature stays in `release-artifacts/`+ until [#441](https://github.com/CategoricalData/hydra/issues/441)+ ([#508](https://github.com/CategoricalData/hydra/issues/508)).++### Known issues++- The `hostOverrides` shim is pinned to `{java: local, python: local}` for the duration of the breaking+ batch, since the new kernel surface is by definition absent from published 0.17.5. It must be retired+ once 0.17.6 is visible in Maven Central and PyPI+ ([#508](https://github.com/CategoricalData/hydra/issues/508)).+- **`hydra-ext` does not ship to Maven Central for Java**, as in 0.17.4 and 0.17.5: the Java coder's+ visitor-pattern inner interface still collides with an enclosing type named `Visitor`+ ([#643](https://github.com/CategoricalData/hydra/issues/643)), so the package does not compile for+ that target. It publishes to Hackage and PyPI as usual.+- The breaking batch leaves three deliberate 0.18 tails, each separately tracked:+ `effects.pure` is retained provisionally pending a name decision+ ([#688](https://github.com/CategoricalData/hydra/issues/688)); the `printable` type class that would+ promote the print/parse convention into enforced dispatch awaits+ [#497](https://github.com/CategoricalData/hydra/issues/497); and the literal conversion lattice is+ gated on [#129](https://github.com/CategoricalData/hydra/issues/129) via+ [#689](https://github.com/CategoricalData/hydra/issues/689). Anticipated `TypeClassConstraint`+ variants remain open as [#686](https://github.com/CategoricalData/hydra/issues/686) — the `set`+ element type must stay orderable as variants are added.++---+ ## [0.17.5] - 2026-08-19 Point release on the 0.17.x line. Two language-surface changes lead: sum-type eliminators unify on
hydra-pg.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.38.1.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack name: hydra-pg-version: 0.17.5+version: 0.17.6 synopsis: Hydra's property-graph (TinkerPop/Gremlin) model and coder support 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". Property graph support for Hydra category: Data@@ -77,7 +77,7 @@ base >=4.19.0 && <4.22 , bytestring >=0.11.5 && <0.13 , containers >=0.6.7 && <0.8- , hydra-kernel ==0.17.5- , hydra-rdf ==0.17.5+ , hydra-kernel ==0.17.6+ , hydra-rdf ==0.17.6 , scientific >=0.3.7 && <0.4 default-language: Haskell2010
src/main/haskell/Com/Gdblab/PathAlgebra/Expressions.hs view
@@ -33,7 +33,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | A conjunction of two selection conditions
src/main/haskell/Com/Gdblab/PathAlgebra/Syntax.hs view
@@ -5,7 +5,7 @@ module Com.Gdblab.PathAlgebra.Syntax where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | An RPQ alternation: either of two sub-expressions
src/main/haskell/Hydra/Cypher/Features.hs view
@@ -5,7 +5,7 @@ module Hydra.Cypher.Features where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Aggregate functions
src/main/haskell/Hydra/Cypher/OpenCypher.hs view
@@ -6,7 +6,7 @@ module Hydra.Cypher.OpenCypher where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | An additive expression: a multiply/divide/modulo expression with zero or more +/- terms
src/main/haskell/Hydra/Decode/Neo4j/Model.hs view
@@ -17,7 +17,7 @@ import qualified Hydra.Neo4j.Model as Model import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Util as Util-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Decoder for hydra.neo4j.model.Constraint
src/main/haskell/Hydra/Decode/Pg/Mapping.hs view
@@ -19,7 +19,7 @@ import qualified Hydra.Pg.Mapping as Mapping import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Util as Util-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Decoder for hydra.pg.mapping.AnnotationSchema
src/main/haskell/Hydra/Decode/Pg/Model.hs view
@@ -17,7 +17,7 @@ import qualified Hydra.Pg.Model as Model import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Util as Util-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Decoder for hydra.pg.model.AdjacentEdge
src/main/haskell/Hydra/Demos/Genpg/Transform.hs view
@@ -49,7 +49,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M import qualified Data.Set as S@@ -76,14 +76,14 @@ Core.TypeLiteral v0 -> case v0 of Core.LiteralTypeBoolean -> Optionals.match (Literals.parseBoolean value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralBoolean parsed)))) Core.LiteralTypeFloat v1 -> case v1 of- Core.FloatTypeFloat32 -> Optionals.match (Literals.readFloat32 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 parsed)))))- Core.FloatTypeFloat64 -> Optionals.match (Literals.readFloat64 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 parsed)))))+ Core.FloatTypeFloat32 -> Optionals.match (Literals.parseFloat32 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 parsed)))))+ Core.FloatTypeFloat64 -> Optionals.match (Literals.parseFloat64 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 parsed))))) _ -> Left (Strings.concat [ "Unsupported float type for column ", cname]) Core.LiteralTypeInteger v1 -> case v1 of- Core.IntegerTypeInt32 -> Optionals.match (Literals.readInt32 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 parsed)))))- Core.IntegerTypeInt64 -> Optionals.match (Literals.readInt64 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 parsed)))))+ Core.IntegerTypeInt32 -> Optionals.match (Literals.parseInt32 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 parsed)))))+ Core.IntegerTypeInt64 -> Optionals.match (Literals.parseInt64 value) (Left parseError) (\parsed -> Right (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 parsed))))) _ -> Left (Strings.concat [ "Unsupported integer type for column ", cname])@@ -218,7 +218,7 @@ -- | Check if any element in a list satisfies a predicate listAny :: (t0 -> Bool) -> [t0] -> Bool-listAny pred xs = Logic.not (Lists.null (Lists.filter pred xs))+listAny pred xs = Logic.not (Lists.isEmpty (Lists.filter pred xs)) -- | Construct a LazyGraph from vertices and edges makeLazyGraph :: [PgModel.Vertex t0] -> [PgModel.Edge t0] -> PgModel.LazyGraph t0@@ -229,7 +229,7 @@ -- | Normalize a CSV field value - empty becomes Nothing normalizeField :: String -> Maybe String-normalizeField s = Logic.ifElse (Strings.null s) Nothing (Just s)+normalizeField s = Logic.ifElse (Strings.isEmpty s) Nothing (Just s) -- | Process a single character during CSV parsing parseCsvChar :: (([Maybe String], String), Bool) -> Int -> (([Maybe String], String), Bool)@@ -238,7 +238,7 @@ let acc = Pairs.first (Pairs.first state) field = Pairs.second (Pairs.first state) inQuotes = Pairs.second state- in (Logic.ifElse (Equality.equal c 34) (Logic.ifElse inQuotes ((acc, field), False) (Logic.ifElse (Strings.null field) ((acc, field), True) ((acc, (Strings.concat2 field "\"")), inQuotes))) (Logic.ifElse (Logic.and (Equality.equal c 44) (Logic.not inQuotes)) ((Lists.cons (normalizeField field) acc, ""), False) ((acc, (Strings.concat2 field (Strings.fromList [+ in (Logic.ifElse (Equality.equal c 34) (Logic.ifElse inQuotes ((acc, field), False) (Logic.ifElse (Strings.isEmpty field) ((acc, field), True) ((acc, (Strings.concat2 field "\"")), inQuotes))) (Logic.ifElse (Logic.and (Equality.equal c 44) (Logic.not inQuotes)) ((Lists.cons (normalizeField field) acc, ""), False) ((acc, (Strings.concat2 field (Strings.fromList [ c]))), inQuotes))) -- | Parse a CSV line into fields. Empty fields become Nothing.@@ -258,7 +258,7 @@ parseSingleLine line = let trimmed = stripWhitespace line- in (Logic.ifElse (Strings.null trimmed) (Right Nothing) (Eithers.map (\x -> Just x) (parseCsvLine trimmed)))+ in (Logic.ifElse (Strings.isEmpty trimmed) (Right Nothing) (Eithers.map (\x -> Just x) (parseCsvLine trimmed))) -- | Parse raw CSV lines into a Table of strings parseTableLines :: Bool -> [String] -> Either String (Tabular.Table String)
src/main/haskell/Hydra/Dsl/Pg/Model.hs view
@@ -6,13 +6,12 @@ import qualified Hydra.Core as Core import qualified Hydra.Decode.Pg.Model as DecodePgModel-import qualified Hydra.Dsl.Core as DslCore import qualified Hydra.Encode.Pg.Model as EncodePgModel import qualified Hydra.Errors as Errors import qualified Hydra.Graph as Graph import qualified Hydra.Pg.Model as Model import qualified Hydra.Typed as Typed-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M
src/main/haskell/Hydra/Encode/Neo4j/Model.hs view
@@ -11,7 +11,7 @@ import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets import qualified Hydra.Neo4j.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Encoder for hydra.neo4j.model.Constraint
src/main/haskell/Hydra/Encode/Pg/Mapping.hs view
@@ -10,7 +10,7 @@ import qualified Hydra.Encode.Pg.Model as Model import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists import qualified Hydra.Pg.Mapping as Mapping-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Encoder for hydra.pg.mapping.AnnotationSchema
src/main/haskell/Hydra/Encode/Pg/Model.hs view
@@ -9,7 +9,7 @@ import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists import qualified Hydra.Overlay.Haskell.Lib.Maps as Maps import qualified Hydra.Pg.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Encoder for hydra.pg.model.AdjacentEdge
src/main/haskell/Hydra/Error/Neo4j.hs view
@@ -6,7 +6,7 @@ import qualified Hydra.Core as Core import qualified Hydra.Neo4j.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | An error indicating that a Neo4j property graph is invalid
src/main/haskell/Hydra/Error/Pg.hs view
@@ -6,7 +6,7 @@ import qualified Hydra.Core as Core import qualified Hydra.Pg.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | An error indicating that an edge is invalid
src/main/haskell/Hydra/Graphviz/Coder.hs view
@@ -18,6 +18,7 @@ import qualified Hydra.Graph as Graph import qualified Hydra.Graphviz.Dot as Dot import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Eithers as Eithers import qualified Hydra.Overlay.Haskell.Lib.Equality as Equality import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists import qualified Hydra.Overlay.Haskell.Lib.Literals as Literals@@ -36,6 +37,7 @@ import qualified Hydra.Regex as Regex import qualified Hydra.Relational as Relational import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Shredding as Shredding import qualified Hydra.System as System import qualified Hydra.Tabular as Tabular import qualified Hydra.Testing as Testing@@ -46,10 +48,54 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M +-- | Convert a typed graph to a subterm-style (link-view) DOT graph+graphToSubtermDotGraph :: Graph.Graph -> Dot.Graph+graphToSubtermDotGraph graph =+ Dot.Graph {+ Dot.graphStrict = False,+ Dot.graphDirected = True,+ Dot.graphId = Nothing,+ Dot.graphStatements = (graphToSubtermDotStmts standardNamespaces graph)}++-- | Convert a typed graph to subterm-style (link-view) DOT statements+graphToSubtermDotStmts :: M.Map Packaging.ModuleName String -> Graph.Graph -> [Dot.Stmt]+graphToSubtermDotStmts namespaces graph =+ Eithers.either (\_ -> []) (\sg ->+ let nodes = Paths.subtermGraphNodes sg+ labelsVisited =+ Lists.foldl (\acc -> \node ->+ let accLabels = Pairs.first acc+ accVisited = Pairs.second acc+ name = Paths.subtermNodeName node+ raw = Names.compactName namespaces name+ uniq = Names.chooseUniqueLabel accVisited raw+ in (Maps.insert name uniq accLabels, (Sets.insert uniq accVisited))) (Maps.empty, Sets.empty) nodes+ labels = Pairs.first labelsVisited+ labelOf = \name -> Optionals.withDefault (Core.unName name) (Maps.lookup name labels)+ nodeStmt =+ \node -> Dot.StmtNode (Dot.NodeStmt {+ Dot.nodeStmtId = (toNodeId (Dot.Id (labelOf (Paths.subtermNodeName node)))),+ Dot.nodeStmtAttributes = (Just (Dot.AttrList [+ [+ labelAttr (labelOf (Paths.subtermNodeName node))]]))})+ edgeStmtsForNode =+ \node ->+ let srcLabel = labelOf (Paths.subtermNodeName node)+ links = Paths.subtermNodeLinks node+ in (Optionals.mapOptional (\link -> case link of+ Paths.SubtermLinkEdge v0 ->+ let tgtLabel = labelOf (Paths.subtermEdgeTarget v0)+ showPath = PrintPaths.subtermPath (Paths.subtermEdgePath v0)+ in (Just (toEdgeStmt (Dot.Id srcLabel) (Dot.Id tgtLabel) (Just (Dot.AttrList [+ [+ labelAttr showPath]]))))+ _ -> Nothing) links)+ in (Lists.concat2 (Lists.map nodeStmt nodes) (Lists.concat (Lists.map edgeStmtsForNode nodes)))) (Shredding.shredGraph graph)+ -- | Create a DOT label attribute labelAttr :: String -> Dot.EqualityPair labelAttr lab =@@ -154,19 +200,19 @@ Core.LiteralBinary v1 -> Literals.binaryToBase64 v1 Core.LiteralBoolean v1 -> Literals.printBoolean v1 Core.LiteralInteger v1 -> case v1 of- Core.IntegerValueBigint v2 -> Literals.showBigint v2- Core.IntegerValueInt8 v2 -> Literals.showInt8 v2- Core.IntegerValueInt16 v2 -> Literals.showInt16 v2- Core.IntegerValueInt32 v2 -> Literals.showInt32 v2- Core.IntegerValueInt64 v2 -> Literals.showInt64 v2- Core.IntegerValueUint8 v2 -> Literals.showUint8 v2- Core.IntegerValueUint16 v2 -> Literals.showUint16 v2- Core.IntegerValueUint32 v2 -> Literals.showUint32 v2- Core.IntegerValueUint64 v2 -> Literals.showUint64 v2+ Core.IntegerValueBigint v2 -> Literals.printBigint v2+ Core.IntegerValueInt8 v2 -> Literals.printInt8 v2+ Core.IntegerValueInt16 v2 -> Literals.printInt16 v2+ Core.IntegerValueInt32 v2 -> Literals.printInt32 v2+ Core.IntegerValueInt64 v2 -> Literals.printInt64 v2+ Core.IntegerValueUint8 v2 -> Literals.printUint8 v2+ Core.IntegerValueUint16 v2 -> Literals.printUint16 v2+ Core.IntegerValueUint32 v2 -> Literals.printUint32 v2+ Core.IntegerValueUint64 v2 -> Literals.printUint64 v2 _ -> "?" Core.LiteralFloat v1 -> case v1 of- Core.FloatValueFloat32 v2 -> Literals.showFloat32 v2- Core.FloatValueFloat64 v2 -> Literals.showFloat64 v2+ Core.FloatValueFloat32 v2 -> Literals.printFloat32 v2+ Core.FloatValueFloat64 v2 -> Literals.printFloat64 v2 _ -> "?" Core.LiteralString v1 -> v1 _ -> "?")@@ -221,8 +267,7 @@ Dot.StmtNode (Dot.NodeStmt { Dot.nodeStmtId = (toNodeId selfId), Dot.nodeStmtAttributes = (Just (labelAttrs nodeStyle rawLabel))})- toAccessorEdgeStmt =- \acc -> \sty -> \i1 -> \i2 -> toEdgeStmt i1 i2 (Optionals.map (\s -> labelAttrs sty s) (PrintPaths.subtermStep acc))+ toAccessorEdgeStmt = \acc -> \sty -> \i1 -> \i2 -> toEdgeStmt i1 i2 (Just (labelAttrs sty (PrintPaths.subtermStep acc))) edgeAttrs = \lab -> Dot.AttrList [ [@@ -290,39 +335,6 @@ toAccessorEdgeStmt accessor style (Optionals.withDefault selfId mparent) i], visited)) _ -> dflt in (Pairs.first (encode Nothing False Maps.empty Nothing ([], Sets.empty) (Paths.SubtermStepAnnotatedBody, term)))---- | Convert a term to an subterm-style DOT graph-termToSubtermDotGraph :: Core.Term -> Dot.Graph-termToSubtermDotGraph term =- Dot.Graph {- Dot.graphStrict = False,- Dot.graphDirected = True,- Dot.graphId = Nothing,- Dot.graphStatements = (termToSubtermDotStmts standardNamespaces term)}---- | Convert a term to subterm-style DOT statements-termToSubtermDotStmts :: M.Map Packaging.ModuleName String -> Core.Term -> [Dot.Stmt]-termToSubtermDotStmts namespaces term =-- let accessorGraph = PrintPaths.termToSubtermGraph namespaces term- nodes = Paths.subtermGraphNodes accessorGraph- edges = Paths.subtermGraphEdges accessorGraph- nodeStmt =- \node -> Dot.StmtNode (Dot.NodeStmt {- Dot.nodeStmtId = (toNodeId (Dot.Id (Paths.subtermNodeId node))),- Dot.nodeStmtAttributes = (Just (Dot.AttrList [- [- labelAttr (Paths.subtermNodeLabel node)]]))})- edgeStmt =- \edge ->- let lab1 = Paths.subtermNodeId (Paths.subtermEdgeSource edge)- lab2 = Paths.subtermNodeId (Paths.subtermEdgeTarget edge)- pathAccessors = Paths.unSubtermPath (Paths.subtermEdgePath edge)- showPath = Strings.join "/" (Optionals.givens (Lists.map PrintPaths.subtermStep pathAccessors))- in (toEdgeStmt (Dot.Id lab1) (Dot.Id lab2) (Just (Dot.AttrList [- [- labelAttr showPath]])))- in (Lists.concat2 (Lists.map nodeStmt nodes) (Lists.map edgeStmt edges)) -- | Create a DOT edge statement toEdgeStmt :: Dot.Id -> Dot.Id -> Maybe Dot.AttrList -> Dot.Stmt
src/main/haskell/Hydra/Graphviz/Dot.hs view
@@ -5,7 +5,7 @@ module Hydra.Graphviz.Dot where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | A Graphviz DOT attribute list: one or more comma/semicolon-separated lists of key-value pairs
src/main/haskell/Hydra/Graphviz/Serde.hs view
@@ -39,7 +39,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Convert an attribute list to an expression@@ -144,7 +144,7 @@ let i = Dot.nodeIdId nid mp = Dot.nodeIdPort nid in (Serialization.noSep (Optionals.givens [- Optionals.pure (idToExpr i),+ Optionals.given (idToExpr i), (Optionals.map portToExpr mp)])) -- | Convert a node or subgraph to an expression@@ -161,7 +161,7 @@ let i = Dot.nodeStmtId ns attr = Dot.nodeStmtAttributes ns in (Serialization.spaceSep (Optionals.givens [- Optionals.pure (nodeIdToExpr i),+ Optionals.given (nodeIdToExpr i), (Optionals.map attrListToExpr attr)])) -- | Convert a port to an expression@@ -196,7 +196,7 @@ subgraphIdToExpr :: Dot.SubgraphId -> Ast.Expr subgraphIdToExpr sid = Serialization.spaceSep (Optionals.givens [- Optionals.pure (Serialization.cst "subgraph"),+ Optionals.given (Serialization.cst "subgraph"), (Optionals.map idToExpr (Dot.unSubgraphId sid))]) -- | Convert a subgraph to an expression@@ -209,4 +209,4 @@ Serialization.brackets Serialization.curlyBraces Serialization.inlineStyle (Serialization.spaceSep (Lists.map (stmtToExpr directed) stmts)) in (Serialization.spaceSep (Optionals.givens [ Optionals.map subgraphIdToExpr mid,- (Optionals.pure body)]))+ (Optionals.given body)]))
src/main/haskell/Hydra/Neo4j/Model.hs view
@@ -5,7 +5,7 @@ module Hydra.Neo4j.Model where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.ByteString as B import qualified Data.Int as I
src/main/haskell/Hydra/Neo4j/Pg.hs view
@@ -19,7 +19,7 @@ import qualified Hydra.Neo4j.Model as Neo4jModel import qualified Hydra.Pg.Model as PgModel import qualified Hydra.Util as Util-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Compute the property-graph edge label for a Neo4j relationship type, given the schema and endpoint labels.
src/main/haskell/Hydra/Pg/Coder.hs view
@@ -50,7 +50,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M @@ -357,7 +357,7 @@ -- | Traverse to a single term, failing if zero or multiple terms are found traverseToSingleTerm :: t0 -> String -> (t1 -> Either Errors.Error [t2]) -> t1 -> Either Errors.Error t2 traverseToSingleTerm cx desc traversal term =- Eithers.bind (traversal term) (\terms -> Logic.ifElse (Lists.null terms) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " did not resolve to a term")))) (Logic.ifElse (Equality.equal (Lists.length terms) 1) (Optionals.match (Lists.head terms) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " resolved to multiple terms")))) (\x -> Right x)) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " resolved to multiple terms"))))))+ Eithers.bind (traversal term) (\terms -> Logic.ifElse (Lists.isEmpty terms) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " did not resolve to a term")))) (Logic.ifElse (Equality.equal (Lists.length terms) 1) (Optionals.match (Lists.head terms) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " resolved to multiple terms")))) (\x -> Right x)) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 desc " resolved to multiple terms")))))) -- | Create a vertex coder given all components vertexCoder :: t0 -> t1 -> Mapping.Schema t2 t3 t4 t5 -> t6 -> t7 -> t8 -> PgModel.VertexLabel -> (Core.Name, (Coders.Adapter t9 t10 Core.Term t4 Errors.Error)) -> [Coders.Adapter Core.FieldType (PgModel.PropertyType t7) Core.Field (PgModel.Property t4) Errors.Error] -> [(
src/main/haskell/Hydra/Pg/Graphson/Coder.hs view
@@ -41,7 +41,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M @@ -66,12 +66,12 @@ -- | Convert a map of edges by label to an optional JSON Value edgeMapToJson :: Bool -> M.Map Syntax.EdgeLabel [Syntax.AdjacentEdge] -> Maybe Model.Value edgeMapToJson out m =- Logic.ifElse (Maps.null m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unEdgeLabel (Pairs.first p), (Model.ValueArray (Lists.map (adjacentEdgeToJson out) (Pairs.second p))))) (Maps.toList m))))+ Logic.ifElse (Maps.isEmpty m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unEdgeLabel (Pairs.first p), (Model.ValueArray (Lists.map (adjacentEdgeToJson out) (Pairs.second p))))) (Maps.toList m)))) -- | Convert a map of edge properties to an optional JSON Value edgePropertyMapToJson :: M.Map Syntax.PropertyKey Syntax.Value -> Maybe Model.Value edgePropertyMapToJson m =- Logic.ifElse (Maps.null m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unPropertyKey (Pairs.first p), (valueToJson (Pairs.second p)))) (Maps.toList m))))+ Logic.ifElse (Maps.isEmpty m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unPropertyKey (Pairs.first p), (valueToJson (Pairs.second p)))) (Maps.toList m)))) -- | Convert a GraphSON FloatValue to a JSON Value floatValueToJson :: Syntax.FloatValue -> Model.Value@@ -110,7 +110,7 @@ Syntax.ValueBinary v0 -> typedValueToJson "g:Binary" (Model.ValueString v0) Syntax.ValueBoolean v0 -> Model.ValueBoolean v0 Syntax.ValueByte v0 -> typedValueToJson "g:Byte" (Model.ValueNumber (Literals.bigintToDecimal (Literals.uint8ToBigint v0)))- Syntax.ValueChar v0 -> typedValueToJson "g:Char" (Model.ValueString (Strings.fromList (Lists.pure (Literals.bigintToInt32 (Literals.uint32ToBigint v0)))))+ Syntax.ValueChar v0 -> typedValueToJson "g:Char" (Model.ValueString (Strings.fromList (Lists.singleton (Literals.bigintToInt32 (Literals.uint32ToBigint v0))))) Syntax.ValueComposite v0 -> typedValueToJson (Syntax.unTypeName (Syntax.compositeTypedValueType v0)) (mapToJson (Syntax.compositeTypedValueFields v0)) Syntax.ValueDateTime v0 -> typedValueToJson "g:DateTime" (Model.ValueString (Syntax.unDateTime v0)) Syntax.ValueDouble v0 -> typedValueToJson "g:Double" (doubleValueToJson v0)@@ -130,7 +130,7 @@ -- | Convert a map of vertex properties to an optional JSON Value vertexPropertyMapToJson :: M.Map Syntax.PropertyKey [Syntax.VertexPropertyValue] -> Maybe Model.Value vertexPropertyMapToJson m =- Logic.ifElse (Maps.null m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unPropertyKey (Pairs.first p), (Model.ValueArray (Lists.map vertexPropertyValueToJson (Pairs.second p))))) (Maps.toList m))))+ Logic.ifElse (Maps.isEmpty m) Nothing (Just (Model.ValueObject (Lists.map (\p -> (Syntax.unPropertyKey (Pairs.first p), (Model.ValueArray (Lists.map vertexPropertyValueToJson (Pairs.second p))))) (Maps.toList m)))) -- | Convert a GraphSON VertexPropertyValue to a JSON Value vertexPropertyValueToJson :: Syntax.VertexPropertyValue -> Model.Value
src/main/haskell/Hydra/Pg/Graphson/Construct.hs view
@@ -41,7 +41,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M @@ -67,7 +67,7 @@ let k = Pairs.first p v = Pairs.second p existing = Maps.lookup k m- in (Maps.insert k (Optionals.match existing (Lists.pure v) (\vs -> Lists.cons v vs)) m)) Maps.empty pairs+ in (Maps.insert k (Optionals.match existing (Lists.singleton v) (\vs -> Lists.cons v vs)) m)) Maps.empty pairs -- | Convert a property graph edge property to a GraphSON property edgePropertyToGraphson :: (t0 -> Either t1 t2) -> (PgModel.PropertyKey, t0) -> Either t1 (Syntax.PropertyKey, t2)
src/main/haskell/Hydra/Pg/Graphson/Syntax.hs view
@@ -5,7 +5,7 @@ module Hydra.Pg.Graphson.Syntax where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Int as I import qualified Data.Map as M
src/main/haskell/Hydra/Pg/Graphson/Utils.hs view
@@ -43,7 +43,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Convert a list of property graph elements to a list of vertices with their adjacent edges
src/main/haskell/Hydra/Pg/Mapping.hs view
@@ -7,7 +7,7 @@ import qualified Hydra.Coders as Coders import qualified Hydra.Core as Core import qualified Hydra.Pg.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Configurable annotation keys for property graph mapping specifications
src/main/haskell/Hydra/Pg/Model.hs view
@@ -5,7 +5,7 @@ module Hydra.Pg.Model where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M
src/main/haskell/Hydra/Pg/Printing.hs view
@@ -38,7 +38,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Print an edge using the provided value printer
src/main/haskell/Hydra/Pg/Query.hs view
@@ -6,7 +6,7 @@ import qualified Hydra.Core as Core import qualified Hydra.Pg.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | An aggregation query over a property graph
src/main/haskell/Hydra/Pg/Rdf/Environment.hs view
@@ -7,7 +7,7 @@ import qualified Hydra.Core as Core import qualified Hydra.Pg.Model as Model import qualified Hydra.Rdf.Syntax as Syntax-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | The environment for property graph to RDF mapping
src/main/haskell/Hydra/Pg/Rdf/Mappings.hs view
@@ -44,7 +44,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Convert edge types into property shape constraints for a given vertex label
src/main/haskell/Hydra/Pg/TermsToElements.hs view
@@ -49,14 +49,14 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M -- | Apply a parsed pattern to a term, producing string terms applyPattern :: t0 -> String -> [([String], String)] -> Core.Term -> Either Errors.Error [Core.Term] applyPattern cx firstLit pairs term =- Logic.ifElse (Lists.null pairs) (Right [+ Logic.ifElse (Lists.isEmpty pairs) (Right [ Core.TermLiteral (Core.LiteralString firstLit)]) (Eithers.bind (Eithers.mapList (\pp -> Eithers.map (\terms -> (Lists.map (\t -> termToString t) terms, (Pairs.second pp))) (evalPath cx (Pairs.first pp) term)) pairs) (\evaluated -> Right (Lists.map (\s -> Core.TermLiteral (Core.LiteralString s)) (Lists.foldl (\accum -> \ep -> let pStrs = Pairs.first ep litP = Pairs.second ep@@ -129,7 +129,7 @@ -- | Evaluate a single step of a path traversal on a term evalStep :: t0 -> String -> Core.Term -> Either Errors.Error [Core.Term] evalStep cx step term =- Logic.ifElse (Strings.null step) (Right [+ Logic.ifElse (Strings.isEmpty step) (Right [ term]) (case (Strip.deannotateTerm term) of Core.TermList v0 -> Eithers.map (\xs -> Lists.concat xs) (Eithers.mapList (evalStep cx step) v0) Core.TermOptional v0 -> Optionals.match v0 (Right []) (\t -> evalStep cx step t)@@ -252,7 +252,7 @@ -- | Require exactly one result from a list-producing function requireUnique :: t0 -> String -> (t1 -> Either Errors.Error [t2]) -> t1 -> Either Errors.Error t2 requireUnique cx context fun term =- Eithers.bind (fun term) (\results -> Logic.ifElse (Lists.null results) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "No value found: " context)))) (Logic.ifElse (Equality.equal (Lists.length results) 1) (Optionals.match (Lists.head results) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "Multiple values found: " context)))) (\x -> Right x)) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "Multiple values found: " context))))))+ Eithers.bind (fun term) (\results -> Logic.ifElse (Lists.isEmpty results) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "No value found: " context)))) (Logic.ifElse (Equality.equal (Lists.length results) 1) (Optionals.match (Lists.head results) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "Multiple values found: " context)))) (\x -> Right x)) (Left (Errors.ErrorOther (Errors.OtherError (Strings.concat2 "Multiple values found: " context)))))) -- | Create an adapter that maps terms to property graph elements using a mapping specification termToElementsAdapter :: t0 -> Graph.Graph -> Mapping.Schema t1 t2 t3 Errors.Error -> Core.Type -> Either Errors.Error (Coders.Adapter Core.Type [PgModel.Label] Core.Term [PgModel.Element t3] Errors.Error)@@ -284,10 +284,10 @@ Core.LiteralString v1 -> v1 Core.LiteralBoolean v1 -> Logic.ifElse v1 "true" "false" Core.LiteralInteger v1 -> case v1 of- Core.IntegerValueInt32 v2 -> Literals.showInt32 v2+ Core.IntegerValueInt32 v2 -> Literals.printInt32 v2 _ -> PrintCore.term term Core.LiteralFloat v1 -> case v1 of- Core.FloatValueFloat64 v2 -> Literals.showFloat64 v2+ Core.FloatValueFloat64 v2 -> Literals.printFloat64 v2 _ -> PrintCore.term term _ -> PrintCore.term term Core.TermOptional v0 -> Optionals.match v0 "none" (\t -> termToString t)
src/main/haskell/Hydra/Pg/Utils.hs view
@@ -45,7 +45,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Default Tinkerpop annotation schema@@ -121,7 +121,7 @@ in (Eithers.map (\propsJson -> JsonModel.ValueObject (Optionals.givens [ Just ("label", labelJson), (Just ("id", (JsonModel.ValueString (PrintCore.term term)))),- propsJson])) ((\pairs -> Logic.ifElse (Maps.null pairs) (Right Nothing) (Eithers.map (\p -> Just ("properties", (JsonModel.ValueObject p))) (Eithers.mapList (\pair ->+ propsJson])) ((\pairs -> Logic.ifElse (Maps.isEmpty pairs) (Right Nothing) (Eithers.map (\p -> Just ("properties", (JsonModel.ValueObject p))) (Eithers.mapList (\pair -> let key = Pairs.first pair v = Pairs.second pair in (Eithers.bind (Coders.coderDecode (Mapping.schemaPropertyValues schema) v) (\term2 -> Right (PgModel.unPropertyKey key, (JsonModel.ValueString (PrintCore.term term2)))))) (Maps.toList pairs)))) (PgModel.vertexProperties v0))))@@ -132,7 +132,7 @@ (Just ("id", (JsonModel.ValueString (PrintCore.term term)))), (Just ("out", (JsonModel.ValueString (PrintCore.term termOut)))), (Just ("in", (JsonModel.ValueString (PrintCore.term termIn)))),- propsJson])) ((\pairs -> Logic.ifElse (Maps.null pairs) (Right Nothing) (Eithers.map (\p -> Just ("properties", (JsonModel.ValueObject p))) (Eithers.mapList (\pair ->+ propsJson])) ((\pairs -> Logic.ifElse (Maps.isEmpty pairs) (Right Nothing) (Eithers.map (\p -> Just ("properties", (JsonModel.ValueObject p))) (Eithers.mapList (\pair -> let key = Pairs.first pair v = Pairs.second pair in (Eithers.bind (Coders.coderDecode (Mapping.schemaPropertyValues schema) v) (\term2 -> Right (PgModel.unPropertyKey key, (JsonModel.ValueString (PrintCore.term term2)))))) (Maps.toList pairs)))) (PgModel.edgeProperties v0))))))) el
src/main/haskell/Hydra/Print/Error/Pg.hs view
@@ -36,7 +36,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Show an invalid edge error as a string
src/main/haskell/Hydra/Tinkerpop/Examples/Modern.hs view
@@ -6,7 +6,7 @@ import qualified Hydra.Core as Core import qualified Hydra.Pg.Model as Model-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M
src/main/haskell/Hydra/Tinkerpop/Features.hs view
@@ -11,7 +11,7 @@ module Hydra.Tinkerpop.Features where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Base interface for features that relate to supporting different data types.
src/main/haskell/Hydra/Tinkerpop/Gremlin.hs view
@@ -5,7 +5,7 @@ module Hydra.Tinkerpop.Gremlin where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Int as I
src/main/haskell/Hydra/Tinkerpop/Language.hs view
@@ -38,7 +38,7 @@ 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 Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | Populate language constraints based on TinkerPop Graph.Features@@ -47,7 +47,7 @@ let vpFeatures = Features.vertexPropertyFeaturesDataTypeFeatures (Features.vertexFeaturesProperties (Features.featuresVertex features))- cond = \v -> \b -> Logic.ifElse b (Optionals.pure v) Nothing+ cond = \v -> \b -> Logic.ifElse b (Optionals.given v) Nothing supportsLists = Logic.or (Features.dataTypeFeaturesSupportsBooleanArrayValues vpFeatures) (Logic.or (Features.dataTypeFeaturesSupportsByteArrayValues vpFeatures) (Logic.or (Features.dataTypeFeaturesSupportsDoubleArrayValues vpFeatures) (Logic.or (Features.dataTypeFeaturesSupportsFloatArrayValues vpFeatures) (Logic.or (Features.dataTypeFeaturesSupportsIntegerArrayValues vpFeatures) (Logic.or (Features.dataTypeFeaturesSupportsLongArrayValues vpFeatures) (Features.dataTypeFeaturesSupportsStringArrayValues vpFeatures)))))) supportsLiterals = True@@ -72,14 +72,14 @@ cond Variants.TermVariantList supportsLists, (cond Variants.TermVariantLiteral supportsLiterals), (cond Variants.TermVariantMap supportsMaps),- (Optionals.pure Variants.TermVariantOptional)])+ (Optionals.given Variants.TermVariantOptional)]) typeVariants = Sets.fromList (Optionals.givens [ cond Variants.TypeVariantList supportsLists, (cond Variants.TypeVariantLiteral supportsLiterals), (cond Variants.TypeVariantMap supportsMaps),- (Optionals.pure Variants.TypeVariantOptional),- (Optionals.pure Variants.TypeVariantWrap)])+ (Optionals.given Variants.TypeVariantOptional),+ (Optionals.given Variants.TypeVariantWrap)]) typePredicate = \typ -> let dt = Strip.deannotateType typ
src/main/haskell/Hydra/Validate/Neo4j.hs view
@@ -16,7 +16,7 @@ import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets import qualified Hydra.Neo4j.Model as Model import qualified Hydra.Validation as Validation-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Set as S @@ -195,7 +195,7 @@ matches = Lists.filter (\net -> Sets.member (Model.nodeElementTypeIdentifyingLabel net) nodeLabels) (Model.graphTypeNodes gt) noMatchCheck =- Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidNodeError.noSuchLabel")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidNodeError.noSuchLabel", f)) (Logic.ifElse (Lists.null matches) (Just (Neo4j.InvalidNodeErrorNoSuchLabel (Neo4j.NoSuchLabelError {+ Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidNodeError.noSuchLabel")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidNodeError.noSuchLabel", f)) (Logic.ifElse (Lists.isEmpty matches) (Just (Neo4j.InvalidNodeErrorNoSuchLabel (Neo4j.NoSuchLabelError { Neo4j.noSuchLabelErrorLabels = (Sets.toList nodeLabels)}))) Nothing)) Nothing matchChecks = Lists.bind matches (\net -> Lists.concat2 (Lists.map (\lab -> Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidNodeError.missingImpliedLabel")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidNodeError.missingImpliedLabel", f)) (Logic.ifElse (Sets.member lab nodeLabels) Nothing (Just (Neo4j.InvalidNodeErrorMissingImpliedLabel (Neo4j.MissingLabelError {@@ -228,10 +228,10 @@ matched = Lists.filter (\ret -> Logic.and (Optionals.match startLabels True (\ls -> Sets.member (Model.relationshipElementTypeStartLabel ret) ls)) (Optionals.match endLabels True (\ls -> Sets.member (Model.relationshipElementTypeEndLabel ret) ls))) candidates noSuchTypeCheck =- Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noSuchType")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noSuchType", f)) (Logic.ifElse (Lists.null candidates) (Just (Neo4j.InvalidRelationshipErrorNoSuchType (Neo4j.NoSuchRelationshipTypeError {+ Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noSuchType")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noSuchType", f)) (Logic.ifElse (Lists.isEmpty candidates) (Just (Neo4j.InvalidRelationshipErrorNoSuchType (Neo4j.NoSuchRelationshipTypeError { Neo4j.noSuchRelationshipTypeErrorType = relType}))) Nothing)) Nothing noPatternCheck =- Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noMatchingPattern")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noMatchingPattern", f)) (Logic.ifElse (Logic.and (Logic.not (Lists.null candidates)) (Logic.and (Logic.and (Optionals.isGiven startLabels) (Optionals.isGiven endLabels)) (Lists.null matched))) (Just (Neo4j.InvalidRelationshipErrorNoMatchingPattern (Neo4j.NoMatchingPatternError {+ Logic.ifElse (enabledNeo4j p (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noMatchingPattern")) (Optionals.map (\f -> (Core.Name "hydra.error.neo4j.InvalidRelationshipError.noMatchingPattern", f)) (Logic.ifElse (Logic.and (Logic.not (Lists.isEmpty candidates)) (Logic.and (Logic.and (Optionals.isGiven startLabels) (Optionals.isGiven endLabels)) (Lists.isEmpty matched))) (Just (Neo4j.InvalidRelationshipErrorNoMatchingPattern (Neo4j.NoMatchingPatternError { Neo4j.noMatchingPatternErrorAllowedPatterns = (Lists.map (\ret -> Neo4j.RelationshipPattern { Neo4j.relationshipPatternStartLabel = (Model.relationshipElementTypeStartLabel ret), Neo4j.relationshipPatternEndLabel = (Model.relationshipElementTypeEndLabel ret)}) candidates),
src/main/haskell/Hydra/Validate/Pg.hs view
@@ -16,7 +16,7 @@ import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets import qualified Hydra.Pg.Model as Model import qualified Hydra.Validation as Validation-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci import qualified Data.Map as M
src/main/haskell/OpenGql/Grammar.hs view
@@ -5,7 +5,7 @@ module OpenGql.Grammar where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci -- | A GQL abbreviated edge pattern: one of a fixed set of alternatives