hasbolt-extras 0.0.1.2 → 0.0.1.3
raw patch · 5 files changed
+30/−5 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Database.Bolt.Extras.DSL.Typed: type LabelConstraint (typ :: Type) = KnownSymbol (GetTypeName (Rep typ))
- Database.Bolt.Extras.Graph: relations :: forall n_aciB a_aciC b_aciD b_alcp. Lens (Graph n_aciB a_aciC b_aciD) (Graph n_aciB a_aciC b_alcp) (Map (n_aciB, n_aciB) b_aciD) (Map (n_aciB, n_aciB) b_alcp)
+ Database.Bolt.Extras.Graph: relations :: forall n_ackW a_ackX b_ackY b_almr. Lens (Graph n_ackW a_ackX b_ackY) (Graph n_ackW a_ackX b_almr) (Map (n_ackW, n_ackW) b_ackY) (Map (n_ackW, n_ackW) b_almr)
- Database.Bolt.Extras.Graph: vertices :: forall n_aciB a_aciC b_aciD a_alcq. Lens (Graph n_aciB a_aciC b_aciD) (Graph n_aciB a_alcq b_aciD) (Map n_aciB a_aciC) (Map n_aciB a_alcq)
+ Database.Bolt.Extras.Graph: vertices :: forall n_ackW a_ackX b_ackY a_alms. Lens (Graph n_ackW a_ackX b_ackY) (Graph n_ackW a_alms b_ackY) (Map n_ackW a_ackX) (Map n_ackW a_alms)
Files
- CHANGELOG.md +6/−0
- hasbolt-extras.cabal +1/−1
- src/Database/Bolt/Extras/DSL/Typed.hs +14/−0
- src/Database/Bolt/Extras/DSL/Typed/Families.hs +5/−4
- src/Database/Bolt/Extras/DSL/Typed/Types.hs +4/−0
CHANGELOG.md view
@@ -6,6 +6,12 @@ ## [Unreleased] +## [0.0.1.3] - 2020-03-04+### Fixed+- https://www.wrike.com/open.htm?id=472936296: fix recursion in `GetTypeFromRecord` type family.+### Added+- Export of `LabelConstraint` to allow users to define wrappers around `lbl`.+ ## [0.0.1.2] - 2020-01-17 ### Added - `=:` type synonym to avoid ticks in type-level tuples.
hasbolt-extras.cabal view
@@ -1,5 +1,5 @@ name: hasbolt-extras-version: 0.0.1.2+version: 0.0.1.3 synopsis: Extras for hasbolt library description: Extras for hasbolt library homepage: https://github.com/biocad/hasbolt-extras#readme
src/Database/Bolt/Extras/DSL/Typed.hs view
@@ -22,6 +22,7 @@ -- $safety SelectorLike(..)+ , LabelConstraint , lbl , prop , propMaybe@@ -285,4 +286,17 @@ > records <- queryWithParams fooQ (#foo =: 42) (#bar =: "Hello") See below for more examples.+-}++{- $tests++These should not generate compile errors.++>>> data TestRecord = TestRecord { first :: Text, second :: Int, third :: Bool, fourth :: Maybe String, fifth :: Text } deriving (Eq, Show, Generic)+>>> defN .& lbl @TestRecord .& prop (#first =: "foo")+... NodeSelector ...+>>> defN .& lbl @TestRecord .& prop (#third =: True) .& prop (#fifth =: "lalala")+... NodeSelector ...+>>> defN .& lbl @TestRecord .& prop (#fourth =: "123") .& prop (#first =: "noes")+... NodeSelector ... -}
src/Database/Bolt/Extras/DSL/Typed/Families.hs view
@@ -28,10 +28,11 @@ GetTypeFromRecord field (D1 _ (C1 _ sels)) = GetTypeFromRecord field sels GetTypeFromRecord field (S1 ('MetaSel ('Just field) _ _ _) (Rec0 (Maybe typ))) = typ GetTypeFromRecord field (S1 ('MetaSel ('Just field) _ _ _) (Rec0 typ)) = typ- GetTypeFromRecord field (S1 ('MetaSel ('Just field) _ _ _) (Rec0 (Maybe typ) ) :*: _) = typ- GetTypeFromRecord field (S1 ('MetaSel ('Just field) _ _ _) (Rec0 typ ) :*: _) = typ- GetTypeFromRecord field (S1 ('MetaSel ('Just _) _ _ _) (Rec0 typ ) :*: r) =- GetTypeFromRecord field r+ GetTypeFromRecord field (l :*: r)+ = If+ (RecordHasField field l)+ (GetTypeFromRecord field l)+ (GetTypeFromRecord field r) -- | This family extracts a type of the field with given name from the first type in the list -- that has it.
src/Database/Bolt/Extras/DSL/Typed/Types.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PolyKinds #-}@@ -76,6 +77,9 @@ => (SymbolS field, Text) -> a types -> a types++-- | Constraint for types that may be used with 'lbl'.+type LabelConstraint (typ :: Type) = KnownSymbol (GetTypeName (Rep typ)) -- | Synonym for 'withLabel' with label type variable as first one, enabling @lbl \@Foo@ type -- application syntax.