Safe Haskell | None |
---|---|
Language | Haskell2010 |
UStore templates generic traversals.
Normally you work with functionality of this module as follows:
1. Pick the function fitting most for your traversal, one of
traverseUStore
, foldUStore
e.t.c.
2. Create a custom datatype value of which will be put to that function.
3. Implement a respective UStoreTemplateTraversable
instance for this
datatype.
Synopsis
- class (Applicative (UStoreTraversalArgumentWrapper way), Applicative (UStoreTraversalMonad way)) => UStoreTraversalWay (way :: Type) where
- type UStoreTraversalArgumentWrapper way :: Type -> Type
- type UStoreTraversalMonad way :: Type -> Type
- class UStoreTraversalWay way => UStoreTraversalFieldHandler (way :: Type) (marker :: UStoreMarkerType) (v :: Type) where
- ustoreTraversalFieldHandler :: KnownUStoreMarker marker => way -> Label name -> UStoreTraversalArgumentWrapper way v -> UStoreTraversalMonad way v
- class UStoreTraversalWay way => UStoreTraversalSubmapHandler (way :: Type) (k :: Type) (v :: Type) where
- ustoreTraversalSubmapHandler :: way -> Label name -> UStoreTraversalArgumentWrapper way (Map k v) -> UStoreTraversalMonad way (Map k v)
- type UStoreTraversable way a = (Generic a, GUStoreTraversable way (Rep a), UStoreTraversalWay way)
- traverseUStore :: forall way template. UStoreTraversable way template => way -> UStoreTraversalArgumentWrapper way template -> UStoreTraversalMonad way template
- modifyUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Identity, UStoreTraversalMonad way ~ Identity) => way -> template -> template
- foldUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Identity, UStoreTraversalMonad way ~ Const res) => way -> template -> res
- genUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Const ()) => way -> UStoreTraversalMonad way template
Documentation
class (Applicative (UStoreTraversalArgumentWrapper way), Applicative (UStoreTraversalMonad way)) => UStoreTraversalWay (way :: Type) Source #
Defines general parameters of UStore template traversal.
You need a separate way
datatype with an instance of this typeclass for each
type of traversal.
type UStoreTraversalArgumentWrapper way :: Type -> Type Source #
Wrapper which will accompany the existing value of traversed template,
aka argument.
This is usually
or Identity
.Const
a
type UStoreTraversalMonad way :: Type -> Type Source #
Instances
UStoreTraversalWay DocumentTW Source # | |
Defined in Lorentz.UStore.Doc type UStoreTraversalArgumentWrapper DocumentTW :: Type -> Type Source # type UStoreTraversalMonad DocumentTW :: Type -> Type Source # | |
UStoreTraversalWay FillUStoreTW Source # | |
Defined in Lorentz.UStore.Haskell type UStoreTraversalArgumentWrapper FillUStoreTW :: Type -> Type Source # type UStoreTraversalMonad FillUStoreTW :: Type -> Type Source # | |
UStoreTraversalWay DecomposeUStoreTW Source # | |
Defined in Lorentz.UStore.Haskell type UStoreTraversalArgumentWrapper DecomposeUStoreTW :: Type -> Type Source # type UStoreTraversalMonad DecomposeUStoreTW :: Type -> Type Source # | |
UStoreTraversalWay MkUStoreTW Source # | |
Defined in Lorentz.UStore.Haskell type UStoreTraversalArgumentWrapper MkUStoreTW :: Type -> Type Source # type UStoreTraversalMonad MkUStoreTW :: Type -> Type Source # |
class UStoreTraversalWay way => UStoreTraversalFieldHandler (way :: Type) (marker :: UStoreMarkerType) (v :: Type) where Source #
Declares a handler for UStore fields when given traversal way is applied.
ustoreTraversalFieldHandler :: KnownUStoreMarker marker => way -> Label name -> UStoreTraversalArgumentWrapper way v -> UStoreTraversalMonad way v Source #
How to process each of UStore fields.
Instances
class UStoreTraversalWay way => UStoreTraversalSubmapHandler (way :: Type) (k :: Type) (v :: Type) where Source #
Declares a handler for UStore submaps when given traversal way is applied.
ustoreTraversalSubmapHandler :: way -> Label name -> UStoreTraversalArgumentWrapper way (Map k v) -> UStoreTraversalMonad way (Map k v) Source #
How to process each of UStore submaps.
Instances
type UStoreTraversable way a = (Generic a, GUStoreTraversable way (Rep a), UStoreTraversalWay way) Source #
Constraint for UStore traversal.
traverseUStore :: forall way template. UStoreTraversable way template => way -> UStoreTraversalArgumentWrapper way template -> UStoreTraversalMonad way template Source #
Perform UStore traversal. The most general way to perform a traversal.
modifyUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Identity, UStoreTraversalMonad way ~ Identity) => way -> template -> template Source #
Modify each UStore entry.
foldUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Identity, UStoreTraversalMonad way ~ Const res) => way -> template -> res Source #
Collect information about UStore entries into monoid.
genUStore :: (UStoreTraversable way template, UStoreTraversalArgumentWrapper way ~ Const ()) => way -> UStoreTraversalMonad way template Source #
Fill UStore template with entries.