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

Grisette.Internal.Core.Data.Class.Mergeable

Description

 
Synopsis

Merging strategy

data MergingStrategy a where Source #

Merging strategies.

You probably do not need to know the details of this type if you are only going to use algebraic data types. You can get merging strategies for them with type derivation.

In Grisette, a merged union (if-then-else tree) follows the hierarchical sorted representation invariant with regards to some merging strategy.

A merging strategy encodes how to merge a subset of the values of a given type. We have three types of merging strategies:

  • Simple strategy
  • Sorted strategy
  • No strategy

The SimpleStrategy merges values with a simple merge function. For example,

  • the symbolic boolean values can be directly merged with symIte.
  • the set {1}, which is a subset of the values of the type Integer, can be simply merged as the set contains only a single value.
  • all the Just values of the type Maybe SymBool can be simply merged by merging the wrapped symbolic boolean with symIte.

The SortedStrategy merges values by first grouping the values with an indexing function, and the values with the same index will be organized as a sub-tree in the if-then-else structure of UnionBase. Each group (sub-tree) will be further merged with a sub-strategy for the index. The index type should be a totally ordered type (with the Ord type class). Grisette will use the indexing function to partition the values into sub-trees, and organize them in a sorted way. The sub-trees will further be merged with the sub-strategies. For example,

  • all the integers can be merged with SortedStrategy by indexing with the identity function and use the SimpleStrategy shown before as the sub-strategies.
  • all the Maybe SymBool values can be merged with SortedStrategy by indexing with isJust, the Nothing and Just values can then be merged with different simple strategies as sub-strategies.

The NoStrategy does not perform any merging. For example, we cannot merge values with function types that returns concrete lists.

For ADTs, we can automatically derive the Mergeable type class, which provides a merging strategy.

If the derived version does not work for you, you should determine if your type can be directly merged with a merging function. If so, you can implement the merging strategy as a SimpleStrategy. If the type cannot be directly merged with a merging function, but could be partitioned into subsets of values that can be simply merged with a function, you should implement the merging strategy as a SortedStrategy. For easier building of the merging strategies, check out the combinators like wrapStrategy.

For more details, please see the documents of the constructors, or refer to Grisette's paper.

Constructors

SimpleStrategy

Simple mergeable strategy.

For symbolic booleans, we can implement its merge strategy as follows:

SimpleStrategy symIte :: MergingStrategy SymBool

Fields

SortedStrategy

Sorted mergeable strategy.

For Integers, we can implement its merge strategy as follows:

SortedStrategy id (\_ -> SimpleStrategy $ \_ t _ -> t)

For Maybe SymBool, we can implement its merge strategy as follows:

SortedStrategy
  (\case; Nothing -> False; Just _ -> True)
  (\idx ->
     if idx
       then SimpleStrategy $ \_ t _ -> t
       else SimpleStrategy $ \cond (Just l) (Just r) -> Just $ symIte cond l r)

Fields

NoStrategy :: MergingStrategy a

For preventing the merging intentionally. This could be useful for keeping some value concrete and may help generate more efficient formulas.

See Grisette's paper for details.

Mergeable

class Mergeable a where Source #

Each type is associated with a root merge strategy given by rootStrategy. The root merge strategy should be able to merge every value of the type. Grisette will use the root merge strategy to merge the values of the type in a union.

Note 1: This type class can be derived for algebraic data types. You may need the DerivingVia and DerivingStrategies extensions.

data X = ... deriving Generic deriving Mergeable via (Default X)

Methods

rootStrategy :: MergingStrategy a Source #

The root merging strategy for the type.

Instances

Instances details
Mergeable All Source # 
Instance details

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

Mergeable Any Source # 
Instance details

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

Mergeable ArithException Source # 
Instance details

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

Mergeable Int16 Source # 
Instance details

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

Mergeable Int32 Source # 
Instance details

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

Mergeable Int64 Source # 
Instance details

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

Mergeable Int8 Source # 
Instance details

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

Mergeable Word16 Source # 
Instance details

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

Mergeable Word32 Source # 
Instance details

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

Mergeable Word64 Source # 
Instance details

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

Mergeable Word8 Source # 
Instance details

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

Mergeable ByteString Source # 
Instance details

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

Mergeable Ordering Source # 
Instance details

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

Mergeable AssertionError Source # 
Instance details

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

Mergeable VerificationConditions Source # 
Instance details

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

Mergeable CEGISCondition Source # 
Instance details

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

Mergeable FreshIndex Source # 
Instance details

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

Mergeable BitwidthMismatch Source # 
Instance details

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

Mergeable FPRoundingMode Source # 
Instance details

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

Mergeable SymBool Source # 
Instance details

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

Mergeable SymFPRoundingMode Source # 
Instance details

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

Mergeable SymInteger Source # 
Instance details

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

Mergeable Text Source # 
Instance details

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

Mergeable Integer Source # 
Instance details

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

Mergeable () Source # 
Instance details

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

Mergeable Bool Source # 
Instance details

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

Mergeable Char Source # 
Instance details

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

Mergeable Double Source # 
Instance details

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

Mergeable Float Source # 
Instance details

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

Mergeable Int Source # 
Instance details

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

Mergeable Word Source # 
Instance details

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

Mergeable a => Mergeable (Identity a) Source # 
Instance details

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

Mergeable a => Mergeable (First a) Source # 
Instance details

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

Mergeable a => Mergeable (Last a) Source # 
Instance details

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

Mergeable a => Mergeable (Down a) Source # 
Instance details

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

Mergeable a => Mergeable (Dual a) Source # 
Instance details

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

Mergeable a => Mergeable (Endo a) Source # 
Instance details

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

Mergeable a => Mergeable (Product a) Source # 
Instance details

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

Mergeable a => Mergeable (Sum a) Source # 
Instance details

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

Mergeable p => Mergeable (Par1 p) Source # 
Instance details

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

(Generic a, GMergeable Arity0 (Rep a)) => Mergeable (Default a) Source # 
Instance details

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

Mergeable a => Mergeable (Union a) Source # 
Instance details

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

Mergeable a => Mergeable (UnionBase a) Source # 
Instance details

Defined in Grisette.Internal.Core.Data.UnionBase

(KnownNat n, 1 <= n) => Mergeable (IntN n) Source # 
Instance details

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

(KnownNat n, 1 <= n) => Mergeable (WordN n) Source # 
Instance details

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

(forall (n :: Nat). (KnownNat n, 1 <= n) => Mergeable (bv n)) => Mergeable (SomeBV bv) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SomeBV

(KnownNat n, 1 <= n) => Mergeable (SymIntN n) Source # 
Instance details

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

(KnownNat n, 1 <= n) => Mergeable (SymWordN n) Source # 
Instance details

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

Mergeable a => Mergeable (Maybe a) Source # 
Instance details

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

Mergeable a => Mergeable [a] Source # 
Instance details

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

(Mergeable a, Mergeable b) => Mergeable (Either a b) Source # 
Instance details

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

Mergeable (U1 p) Source # 
Instance details

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

Mergeable (V1 p) Source # 
Instance details

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

(Generic1 f, GMergeable Arity1 (Rep1 f), Mergeable a) => Mergeable (Default1 f a) Source # 
Instance details

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

(Mergeable e, Mergeable a) => Mergeable (CBMCEither e a) Source # 
Instance details

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

(Mergeable a, Mergeable1 m) => Mergeable (FreshT m a) Source # 
Instance details

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

ValidFP eb sb => Mergeable (FP eb sb) Source # 
Instance details

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

ValidFP eb sb => Mergeable (SymFP eb sb) Source # 
Instance details

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

(SupportedPrim (ca --> cb), LinkedRep ca sa, LinkedRep cb sb) => Mergeable (sa -~> sb) Source # 
Instance details

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

(SupportedPrim (ca =-> cb), LinkedRep ca sa, LinkedRep cb sb) => Mergeable (sa =~> sb) Source # 
Instance details

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

(Mergeable1 m, Mergeable a) => Mergeable (MaybeT m a) Source # 
Instance details

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

(IsConcrete k, Mergeable t) => Mergeable (HashMap k (Union (Maybe t))) Source # 
Instance details

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

(Mergeable a, Mergeable b) => Mergeable (a, b) Source # 
Instance details

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

Mergeable b => Mergeable (a -> b) Source # 
Instance details

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

Mergeable a => Mergeable (Const a b) Source # 
Instance details

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

Mergeable (f a) => Mergeable (Ap f a) Source # 
Instance details

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

Mergeable (f a) => Mergeable (Alt f a) Source # 
Instance details

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

Mergeable (f p) => Mergeable (Rec1 f p) Source # 
Instance details

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

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

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

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

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

(Mergeable1 m, Mergeable a) => Mergeable (IdentityT m a) Source # 
Instance details

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

(Mergeable a, Mergeable1 m) => Mergeable (ReaderT s m a) Source # 
Instance details

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

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

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

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

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

(Mergeable s, Mergeable a, Mergeable1 m) => Mergeable (WriterT s m a) Source # 
Instance details

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

(Mergeable s, Mergeable a, Mergeable1 m) => Mergeable (WriterT s m a) Source # 
Instance details

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

(Mergeable a, Mergeable b, Mergeable c) => Mergeable (a, b, c) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c) Source #

(Mergeable (l a), Mergeable (r a)) => Mergeable (Product l r a) Source # 
Instance details

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

(Mergeable (l a), Mergeable (r a)) => Mergeable (Sum l r a) Source # 
Instance details

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

(Mergeable (f p), Mergeable (g p)) => Mergeable ((f :*: g) p) Source # 
Instance details

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

(Mergeable (f p), Mergeable (g p)) => Mergeable ((f :+: g) p) Source # 
Instance details

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

Mergeable c => Mergeable (K1 i c p) Source # 
Instance details

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

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

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d) => Mergeable (a, b, c, d) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d) Source #

Mergeable (f (g a)) => Mergeable (Compose f g a) Source # 
Instance details

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

Mergeable (f (g p)) => Mergeable ((f :.: g) p) Source # 
Instance details

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

Mergeable (f p) => Mergeable (M1 i c f p) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (M1 i c f p) Source #

(Mergeable s, Mergeable w, Mergeable a, Mergeable1 m) => Mergeable (RWST r w s m a) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (RWST r w s m a) Source #

(Mergeable s, Mergeable w, Mergeable a, Mergeable1 m) => Mergeable (RWST r w s m a) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (RWST r w s m a) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e) => Mergeable (a, b, c, d, e) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f) => Mergeable (a, b, c, d, e, f) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g) => Mergeable (a, b, c, d, e, f, g) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h) => Mergeable (a, b, c, d, e, f, g, h) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i) => Mergeable (a, b, c, d, e, f, g, h, i) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j) => Mergeable (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k) => Mergeable (a, b, c, d, e, f, g, h, i, j, k) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j, k) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l) => Mergeable (a, b, c, d, e, f, g, h, i, j, k, l) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l, Mergeable m) => Mergeable (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, m) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l, Mergeable m, Mergeable n) => Mergeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l, Mergeable m, Mergeable n, Mergeable o) => Mergeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # 
Instance details

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

Methods

rootStrategy :: MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source #

class (forall a. Mergeable a => Mergeable (u a)) => Mergeable1 (u :: Type -> Type) where Source #

Lifting of the Mergeable class to unary type constructors.

Methods

liftRootStrategy :: MergingStrategy a -> MergingStrategy (u a) Source #

Lift merge strategy through the type constructor.

Instances

Instances details
Mergeable1 Identity Source # 
Instance details

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

Mergeable1 First Source # 
Instance details

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

Mergeable1 Last Source # 
Instance details

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

Mergeable1 Down Source # 
Instance details

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

Mergeable1 Dual Source # 
Instance details

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

Mergeable1 Endo Source # 
Instance details

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

Mergeable1 Product Source # 
Instance details

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

Mergeable1 Sum Source # 
Instance details

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

Mergeable1 Union Source # 
Instance details

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

Mergeable1 UnionBase Source # 
Instance details

Defined in Grisette.Internal.Core.Data.UnionBase

Mergeable1 Maybe Source # 
Instance details

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

Mergeable1 List Source # 
Instance details

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

Mergeable a => Mergeable1 (Either a) Source # 
Instance details

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

(Generic1 f, GMergeable Arity1 (Rep1 f)) => Mergeable1 (Default1 f) Source # 
Instance details

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

Mergeable e => Mergeable1 (CBMCEither e) Source # 
Instance details

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

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

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

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

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

Mergeable a => Mergeable1 ((,) a) Source # 
Instance details

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

Mergeable a => Mergeable1 (Const a :: Type -> Type) Source # 
Instance details

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

Mergeable1 f => Mergeable1 (Ap f) Source # 
Instance details

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

Mergeable1 f => Mergeable1 (Alt f) Source # 
Instance details

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

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

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

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

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

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

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

Mergeable1 m => Mergeable1 (ReaderT s m) Source # 
Instance details

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

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

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

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

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

(Mergeable s, Mergeable1 m) => Mergeable1 (WriterT s m) Source # 
Instance details

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

(Mergeable s, Mergeable1 m) => Mergeable1 (WriterT s m) Source # 
Instance details

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

(Mergeable a, Mergeable b) => Mergeable1 ((,,) a b) Source # 
Instance details

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

(Mergeable1 l, Mergeable1 r) => Mergeable1 (Product l r) Source # 
Instance details

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

(Mergeable1 l, Mergeable1 r) => Mergeable1 (Sum l r) Source # 
Instance details

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

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

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

(Mergeable a, Mergeable b, Mergeable c) => Mergeable1 ((,,,) a b c) Source # 
Instance details

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

Mergeable1 ((->) a) Source # 
Instance details

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

(Mergeable1 f, Mergeable1 g) => Mergeable1 (Compose f g) Source # 
Instance details

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

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

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

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

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d) => Mergeable1 ((,,,,) a b c d) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e) => Mergeable1 ((,,,,,) a b c d e) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f) => Mergeable1 ((,,,,,,) a b c d e f) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g) => Mergeable1 ((,,,,,,,) a b c d e f g) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h) => Mergeable1 ((,,,,,,,,) a b c d e f g h) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i) => Mergeable1 ((,,,,,,,,,) a b c d e f g h i) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j) => Mergeable1 ((,,,,,,,,,,) a b c d e f g h i j) Source # 
Instance details

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

Methods

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

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k) => Mergeable1 ((,,,,,,,,,,,) a b c d e f g h i j k) Source # 
Instance details

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

Methods

liftRootStrategy :: MergingStrategy a0 -> MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, a0) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l) => Mergeable1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) Source # 
Instance details

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

Methods

liftRootStrategy :: MergingStrategy a0 -> MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, a0) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l, Mergeable m) => Mergeable1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) Source # 
Instance details

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

Methods

liftRootStrategy :: MergingStrategy a0 -> MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) Source #

(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g, Mergeable h, Mergeable i, Mergeable j, Mergeable k, Mergeable l, Mergeable m, Mergeable n) => Mergeable1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) Source # 
Instance details

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

Methods

liftRootStrategy :: MergingStrategy a0 -> MergingStrategy (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) Source #

rootStrategy1 :: (Mergeable a, Mergeable1 u) => MergingStrategy (u a) Source #

Lift the root merge strategy through the unary type constructor.

class (forall a. Mergeable a => Mergeable1 (u a)) => Mergeable2 (u :: Type -> Type -> Type) where Source #

Lifting of the Mergeable class to binary type constructors.

Methods

liftRootStrategy2 :: MergingStrategy a -> MergingStrategy b -> MergingStrategy (u a b) Source #

Lift merge strategy through the type constructor.

rootStrategy2 :: (Mergeable a, Mergeable b, Mergeable2 u) => MergingStrategy (u a b) Source #

Lift the root merge strategy through the binary type constructor.

class (forall a. Mergeable a => Mergeable2 (u a)) => Mergeable3 (u :: Type -> Type -> Type -> Type) where Source #

Lifting of the Mergeable class to ternary type constructors.

Methods

liftRootStrategy3 :: MergingStrategy a -> MergingStrategy b -> MergingStrategy c -> MergingStrategy (u a b c) Source #

Lift merge strategy through the type constructor.

rootStrategy3 :: (Mergeable a, Mergeable b, Mergeable c, Mergeable3 u) => MergingStrategy (u a b c) Source #

Lift the root merge strategy through the binary type constructor.

Generic Mergeable

data family MergeableArgs arity a :: Type Source #

The arguments to the generic merging strategy function.

class GMergeable arity f where Source #

The class of types that can be generically merged.

Instances

Instances details
GMergeable Arity1 Par1 Source # 
Instance details

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

GMergeable arity (U1 :: Type -> Type) Source # 
Instance details

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

GMergeable arity (V1 :: Type -> Type) Source # 
Instance details

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

Mergeable1 f => GMergeable Arity1 (Rec1 f) Source # 
Instance details

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

(GMergeable arity a, GMergeable arity b) => GMergeable arity (a :*: b) Source # 
Instance details

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

Methods

grootStrategy :: MergeableArgs arity a0 -> MergingStrategy ((a :*: b) a0) Source #

(GMergeable arity a, GMergeable arity b) => GMergeable arity (a :+: b) Source # 
Instance details

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

Methods

grootStrategy :: MergeableArgs arity a0 -> MergingStrategy ((a :+: b) a0) Source #

Mergeable c => GMergeable arity (K1 i c :: Type -> Type) Source # 
Instance details

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

Methods

grootStrategy :: MergeableArgs arity a -> MergingStrategy (K1 i c a) Source #

(Mergeable1 f, GMergeable Arity1 g) => GMergeable Arity1 (f :.: g) Source # 
Instance details

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

GMergeable arity a => GMergeable arity (M1 i c a) Source # 
Instance details

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

Methods

grootStrategy :: MergeableArgs arity a0 -> MergingStrategy (M1 i c a a0) Source #

Combinators for manually building merging strategies

wrapStrategy Source #

Arguments

:: MergingStrategy a

The merge strategy to be wrapped

-> (a -> b)

The wrap function

-> (b -> a)

The unwrap function, which does not have to be defined for every value

-> MergingStrategy b 

Useful utility function for building merge strategies manually.

For example, to build the merge strategy for the just branch of Maybe a, one could write

wrapStrategy Just fromMaybe rootStrategy :: MergingStrategy (Maybe a)

product2Strategy Source #

Arguments

:: (a -> b -> r)

The wrap function

-> (r -> (a, b))

The unwrap function, which does not have to be defined for every value

-> MergingStrategy a

The first merge strategy to be wrapped

-> MergingStrategy b

The second merge strategy to be wrapped

-> MergingStrategy r 

Useful utility function for building merge strategies for product types manually.

For example, to build the merge strategy for the following product type, one could write

data X = X { x1 :: Int, x2 :: Bool }
product2Strategy X (\(X a b) -> (a, b)) rootStrategy rootStrategy
  :: MergingStrategy X

data StrategyList container where Source #

Helper type for building efficient merge strategy for list-like containers.

Constructors

StrategyList :: forall a container. container [DynamicSortedIdx] -> container (MergingStrategy a) -> StrategyList container 

Instances

Instances details
Show1 container => Show (StrategyList container) Source # 
Instance details

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

Methods

showsPrec :: Int -> StrategyList container -> ShowS #

show :: StrategyList container -> String #

showList :: [StrategyList container] -> ShowS #

Eq1 container => Eq (StrategyList container) Source # 
Instance details

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

Methods

(==) :: StrategyList container -> StrategyList container -> Bool #

(/=) :: StrategyList container -> StrategyList container -> Bool #

Ord1 container => Ord (StrategyList container) Source # 
Instance details

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

Methods

compare :: StrategyList container -> StrategyList container -> Ordering #

(<) :: StrategyList container -> StrategyList container -> Bool #

(<=) :: StrategyList container -> StrategyList container -> Bool #

(>) :: StrategyList container -> StrategyList container -> Bool #

(>=) :: StrategyList container -> StrategyList container -> Bool #

max :: StrategyList container -> StrategyList container -> StrategyList container #

min :: StrategyList container -> StrategyList container -> StrategyList container #

buildStrategyList :: forall a container. Functor container => MergingStrategy a -> container a -> StrategyList container Source #

Helper function for building efficient merge strategy for list-like containers.

resolveStrategy :: forall x. MergingStrategy x -> x -> ([DynamicSortedIdx], MergingStrategy x) Source #

Resolves the indices and the terminal merge strategy for a value of some Mergeable type.

resolveStrategy' :: forall x. x -> MergingStrategy x -> ([DynamicSortedIdx], MergingStrategy x) Source #

Resolves the indices and the terminal merge strategy for a value given a merge strategy for its type.