Maintainer | Toshio Ito <debug.ito@gmail.com> |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extra utility functions implemented by Greskell.
Since: 0.2.3.0
Synopsis
- lookupAs :: (PMapKey k, NonEmptyLike c, PMapValue k ~ a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException a
- lookupAs' :: (PMapKey k, NonEmptyLike c, PMapValue k ~ Maybe a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException (Maybe a)
- lookupListAs :: (PMapKey k, NonEmptyLike c, PMapValue k ~ a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException (NonEmpty a)
- lookupListAs' :: (PMapKey k, NonEmptyLike c, PMapValue k ~ Maybe a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException [Maybe a]
- pMapToFail :: MonadFail m => Either PMapLookupException a -> m a
- writeKeyValues :: Element e => [KeyValue e] -> Walk SideEffect e e
- (<=:>) :: ToJSON b => Key a b -> b -> Binder (KeyValue a)
- (<=?>) :: ToJSON b => Key a (Maybe b) -> Maybe b -> Binder (KeyValue a)
- writePropertyKeyValues :: (ToJSON v, Element e) => [(Text, v)] -> Binder (Walk SideEffect e e)
- writePMapProperties :: (Foldable c, ToJSON v, Element e) => PMap c v -> Binder (Walk SideEffect e e)
- gWhenEmptyInput :: (ToGTraversal g, Split cc c, Lift Transform cc, Lift Transform c, WalkType c, WalkType cc) => g cc [s] s -> Walk c s s
- examples :: [(String, String)]
Property readers
Re-export property readers.
Since: 1.0.0.0
lookupAs :: (PMapKey k, NonEmptyLike c, PMapValue k ~ a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException a Source #
Lookup the value and parse it into a
.
lookupAs' :: (PMapKey k, NonEmptyLike c, PMapValue k ~ Maybe a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException (Maybe a) Source #
lookupListAs :: (PMapKey k, NonEmptyLike c, PMapValue k ~ a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException (NonEmpty a) Source #
Look up the values and parse them into a
.
lookupListAs' :: (PMapKey k, NonEmptyLike c, PMapValue k ~ Maybe a, FromGraphSON a) => k -> PMap c GValue -> Either PMapLookupException [Maybe a] Source #
Similar to lookupListAs
, but this function accepts null
results.
If the key k
is not found in the map, it returns an empty
list. If the key k
is found and null
s are included in the
values, they are obtained as Nothing
.
pMapToFail :: MonadFail m => Either PMapLookupException a -> m a Source #
Convert the lookup result into a MonadFail
. It fails with the
description returned by pMapDecribeError
.
Property writers
writeKeyValues :: Element e => [KeyValue e] -> Walk SideEffect e e Source #
(<=?>) :: ToJSON b => Key a (Maybe b) -> Maybe b -> Binder (KeyValue a) Source #
Like <=:>
, but this one is for an optional property. If the
value is Just
, it's equivalent to <=:>
. If the value is
Nothing
, it returns KeyNoValue
.
Since: 1.0.0.0
writePropertyKeyValues :: (ToJSON v, Element e) => [(Text, v)] -> Binder (Walk SideEffect e e) Source #
Make a series of .property
steps to write the given key-value
pairs as properties.
Since: 0.2.3.0
writePMapProperties :: (Foldable c, ToJSON v, Element e) => PMap c v -> Binder (Walk SideEffect e e) Source #
Make a series of .property
steps to write all properties in the
given PMap
.
Since: 1.0.0.0
Control idioms
:: (ToGTraversal g, Split cc c, Lift Transform cc, Lift Transform c, WalkType c, WalkType cc) | |
=> g cc [s] s | the body traversal |
-> Walk c s s | the result walk |
The result Walk
emits the input elements as-is when there is at
least one input element. If there is no input element, it runs the
body traversal once and outputs its result.
You can use this function to implement "upsert" a vertex (i.e. add a vertex if not exist).
See also: https://stackoverflow.com/questions/46027444/
Since: 1.1.0.0