grisette-0.5.0.0: Symbolic evaluation as a library
Copyright(c) Sirui Lu 2023-2024
LicenseBSD-3-Clause (see the LICENSE file)
Maintainersiruilu@cs.washington.edu
StabilityExperimental
PortabilityGHC only
Safe HaskellSafe-Inferred
LanguageHaskell2010

Grisette.Internal.Core.Data.Class.TryMerge

Description

 
Synopsis

Documentation

class TryMerge m where Source #

A class for containers that may or may not be merged.

If the container is capable of multi-path execution, then the tryMergeWithStrategy function should merge the paths according to the supplied strategy.

If the container is not capable of multi-path execution, then the tryMergeWithStrategy function should be equivalent to id.

Note that this will not necessarily do a recursive merge for the elements.

Methods

tryMergeWithStrategy :: MergingStrategy a -> m a -> m a Source #

Instances

Instances details
TryMerge Identity Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge Sum Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge UnionM Source # 
Instance details

Defined in Grisette.Internal.Core.Control.Monad.UnionM

TryMerge Union Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Union

TryMerge Maybe Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge List Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a -> [a] -> [a] Source #

TryMerge (Either a) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge m => TryMerge (FreshT m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.GenSym

TryMerge m => TryMerge (MaybeT m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge ((,) a) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, a0) -> (a, a0) Source #

(TryMerge m, Mergeable e) => TryMerge (CBMCExceptT e m) Source # 
Instance details

Defined in Grisette.Internal.Core.Control.Monad.CBMCExcept

(Mergeable e, TryMerge m) => TryMerge (ExceptT e m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge m => TryMerge (IdentityT m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge m => TryMerge (ReaderT r m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

(Mergeable s, TryMerge m) => TryMerge (StateT s m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

(Mergeable s, TryMerge m) => TryMerge (StateT s m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

(Monoid w, Mergeable w, TryMerge m) => TryMerge (WriterT w m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

(Monoid w, Mergeable w, TryMerge m) => TryMerge (WriterT w m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

TryMerge ((,,) a b) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, a0) -> (a, b, a0) Source #

(TryMerge f, TryMerge g) => TryMerge (Sum f g) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a -> Sum f g a -> Sum f g a Source #

(TryMerge m, Mergeable r) => TryMerge (ContT r m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a -> ContT r m a -> ContT r m a Source #

TryMerge ((,,,) a b c) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, a0) -> (a, b, c, a0) Source #

(Monoid w, Mergeable w, Mergeable s, TryMerge m) => TryMerge (RWST r w s m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a -> RWST r w s m a -> RWST r w s m a Source #

(Monoid w, Mergeable w, Mergeable s, TryMerge m) => TryMerge (RWST r w s m) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a -> RWST r w s m a -> RWST r w s m a Source #

TryMerge ((,,,,) a b c d) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, d, a0) -> (a, b, c, d, a0) Source #

TryMerge ((,,,,,) a b c d e) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, d, e, a0) -> (a, b, c, d, e, a0) Source #

TryMerge ((,,,,,,) a b c d e f) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, d, e, f, a0) -> (a, b, c, d, e, f, a0) Source #

TryMerge ((,,,,,,,) a b c d e f g) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, d, e, f, g, a0) -> (a, b, c, d, e, f, g, a0) Source #

TryMerge ((,,,,,,,,) a b c d e f g h) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.TryMerge

Methods

tryMergeWithStrategy :: MergingStrategy a0 -> (a, b, c, d, e, f, g, h, a0) -> (a, b, c, d, e, f, g, h, a0) Source #

tryMerge :: (TryMerge m, Mergeable a) => m a -> m a Source #

Try to merge the container with the root strategy.

type MonadTryMerge f = (TryMerge f, Monad f) Source #

Alias for a monad type that has TryMerge.

mrgSingle :: (TryMerge m, Applicative m, Mergeable a) => a -> m a Source #

Wrap a value in the applicative functor and propagate the type's root merge strategy.

Equivalent to mrgSingleWithStrategy rootStrategy.

>>> mrgSingle "a" :: UnionM SymInteger
{a}

mrgSingleWithStrategy :: (TryMerge m, Applicative m) => MergingStrategy a -> a -> m a Source #

Wrap a value in the applicative functor and capture the Mergeable knowledge.

>>> mrgSingleWithStrategy rootStrategy "a" :: UnionM SymInteger
{a}

Note: Be careful to call this directly from your code. The supplied merge strategy should be consistent with the type's root merge strategy, or some internal invariants would be broken and the program can crash.

This function is to be called when the Mergeable constraint can not be resolved, e.g., the merge strategy for the contained type is given with Mergeable1. In other cases, mrgPure is usually a better alternative.