lorentz-0.6.1: EDSL for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Lorentz.UStore.Traversal

Description

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

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.

Associated Types

type UStoreTraversalArgumentWrapper way :: Type -> Type Source #

Wrapper which will accompany the existing value of traversed template, aka argument. This is usually Identity or Const a.

type UStoreTraversalMonad way :: Type -> Type Source #

Additional constraints on monadic action used in traversal. Common ones include Identity, Const, (,) a

class UStoreTraversalWay way => UStoreTraversalFieldHandler (way :: Type) (marker :: UStoreMarkerType) (v :: Type) where Source #

Declares a handler for UStore fields when given traversal way is applied.

Methods

ustoreTraversalFieldHandler :: KnownUStoreMarker marker => way -> Label name -> UStoreTraversalArgumentWrapper way v -> UStoreTraversalMonad way v Source #

How to process each of UStore fields.

class UStoreTraversalWay way => UStoreTraversalSubmapHandler (way :: Type) (k :: Type) (v :: Type) where Source #

Declares a handler for UStore submaps when given traversal way is applied.

Methods

ustoreTraversalSubmapHandler :: way -> Label name -> UStoreTraversalArgumentWrapper way (Map k v) -> UStoreTraversalMonad way (Map k v) Source #

How to process each of UStore submaps.

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.