-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Small step semantics
--   
--   Small step semantics
@package small-steps
@version 0.1.0.0

module Control.Iterate.Collect
newtype Cont ans x
Cont :: ((x -> ans) -> ans) -> Cont ans x
[runCont] :: Cont ans x -> (x -> ans) -> ans
newtype Collect tuple
Collect :: (forall ans. ans -> (tuple -> ans -> ans) -> ans) -> Collect tuple
[runCollect] :: Collect tuple -> forall ans. ans -> (tuple -> ans -> ans) -> ans

-- | A (Collect t) is completely agnostic over how <tt>t</tt>s are beging
--   collected. We can make this abstraction concrete by using fixAction.
fixAction :: Collect tuple -> ans -> (tuple -> ans -> ans) -> ans
mapify :: Ord a => Collect (a, b) -> Map a b
listify :: Collect (a, b) -> [(a, b)]
count :: Collect (a, b) -> Int

-- | Here are several ways to add a new t to what is being collected.
--   
--   The <a>one</a> and <a>none</a> interface are used when we want
--   collections with 0 or 1 elements
one :: t -> Collect t
none :: Collect t

-- | The <a>front</a> and <a>rear</a> interface can add to either end of
--   the sequence (both in constant time)
front :: t -> Collect t -> Collect t
rear :: Collect t -> t -> Collect t

-- | Conditional collecting
when :: Bool -> Collect ()
takeC :: Int -> Collect t -> [t]
isempty :: Collect t -> Bool
nonempty :: Collect t -> Bool
hasElem :: Collect t -> Maybe t
newtype ColPlus tuple
ColPlus :: (forall ans. ans -> (tuple -> ans -> ans) -> (ans -> ans -> ans) -> ans) -> ColPlus tuple
[runColPlus] :: ColPlus tuple -> forall ans. ans -> (tuple -> ans -> ans) -> (ans -> ans -> ans) -> ans
runPlus :: Monoid a => ColPlus t -> a -> (t -> a -> a) -> a
instance GHC.Base.Functor Control.Iterate.Collect.ColPlus
instance GHC.Base.Applicative Control.Iterate.Collect.ColPlus
instance GHC.Base.Monad Control.Iterate.Collect.ColPlus
instance GHC.Base.Alternative Control.Iterate.Collect.ColPlus
instance GHC.Base.MonadPlus Control.Iterate.Collect.ColPlus
instance GHC.Base.Functor Control.Iterate.Collect.Collect
instance GHC.Base.Applicative Control.Iterate.Collect.Collect
instance GHC.Base.Monad Control.Iterate.Collect.Collect
instance Data.Foldable.Foldable Control.Iterate.Collect.Collect
instance GHC.Show.Show t => GHC.Show.Show (Control.Iterate.Collect.Collect t)
instance GHC.Base.Functor (Control.Iterate.Collect.Cont ans)
instance GHC.Base.Applicative (Control.Iterate.Collect.Cont ans)
instance GHC.Base.Monad (Control.Iterate.Collect.Cont r)


-- | Small step state transition systems.
module Control.State.Transition.Extended
data RuleType
Initial :: RuleType
Transition :: RuleType
class RuleTypeRep t
type family RuleContext (t :: RuleType) = (ctx :: Type -> Type) | ctx -> t

-- | Context available to initial rules.
newtype IRC sts
IRC :: Environment sts -> IRC sts

-- | Context available to transition rules.
newtype TRC sts
TRC :: (Environment sts, State sts, Signal sts) -> TRC sts
type Rule sts rtype = F (Clause sts rtype)
type TransitionRule sts = Rule sts 'Transition (State sts)
type InitialRule sts = Rule sts 'Initial (State sts)

-- | An assertion is a validation condition for the STS system in question.
--   It should be used to define properties of the system as a whole that
--   cannot be violated under normal circumstances - e.g. a violation
--   implies a failing in the rule logic.
--   
--   Assertions should not check for conditions that may differ between
--   different rules in a system, since the interpreter may stop the system
--   upon presence of a failed assertion.
--   
--   Whether assertions are checked is a matter for the STS interpreter.
data Assertion sts

-- | Pre-condition. Checked before the rule fires.
PreCondition :: String -> (TRC sts -> Bool) -> Assertion sts

-- | Post-condition. Checked after the rule fires, and given access to the
--   resultant state as well as the initial context.
PostCondition :: String -> (TRC sts -> State sts -> Bool) -> Assertion sts
data AssertionViolation sts
AssertionViolation :: String -> String -> TRC sts -> Maybe (State sts) -> AssertionViolation sts
[avSTS] :: AssertionViolation sts -> String
[avMsg] :: AssertionViolation sts -> String
[avCtx] :: AssertionViolation sts -> TRC sts
[avState] :: AssertionViolation sts -> Maybe (State sts)

-- | State transition system.
class (Eq (PredicateFailure a), Show (PredicateFailure a), Monad (BaseM a), Typeable a) => STS a where {
    
    -- | Type of the state which the system transitions between.
    type family State a :: Type;
    
    -- | Signal triggering a state change.
    type family Signal a :: Type;
    
    -- | Environment type.
    type family Environment a :: Type;
    
    -- | Monad into which to interpret the rules.
    type family BaseM a :: Type -> Type;
    
    -- | Descriptive type for the possible failures which might cause a
    --   transition to fail.
    --   
    --   As a convention, <a>PredicateFailure</a>s which are "structural"
    --   (meaning that they are not "throwable" in practice, and are used to
    --   pass control from one transition rule to another) are prefixed with
    --   <tt>S_</tt>.
    --   
    --   Structural <a>PredicateFailure</a>s represent conditions between rules
    --   where the disjunction of all rules' preconditions is equal to
    --   <a>True</a>. That is, either one rule will throw a structural
    --   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
    type family PredicateFailure a = (b :: Type) | b -> a;
    type BaseM a = Identity;
}

-- | Rules governing transition under this system.
initialRules :: STS a => [InitialRule a]
transitionRules :: STS a => [TransitionRule a]

-- | Assertions about the transition system.
assertions :: STS a => [Assertion a]

-- | Render an assertion violation.
--   
--   Defaults to using <a>show</a>, but note that this does not know how to
--   render the context. So for more information you should define your own
--   renderer here.
renderAssertionViolation :: STS a => AssertionViolation a -> String

-- | Embed one STS within another.
class (STS sub, BaseM sub ~ BaseM super) => Embed sub super

-- | Wrap a predicate failure of the subsystem in a failure of the
--   super-system.
wrapFailed :: Embed sub super => PredicateFailure sub -> PredicateFailure super

-- | Oh noes!
--   
--   This takes a condition (a boolean expression) and a failure and
--   results in a clause which will throw that failure if the condition
--   fails.
(?!) :: Bool -> PredicateFailure sts -> Rule sts ctx ()
infix 1 ?!

-- | Oh noes with an explanation
--   
--   We interpret this as "What?" "No!" "Because:"
(?!:) :: Either e () -> (e -> PredicateFailure sts) -> Rule sts ctx ()
failBecause :: PredicateFailure sts -> Rule sts ctx ()

-- | Get the judgment context
judgmentContext :: Rule sts rtype (RuleContext rtype sts)
trans :: Embed sub super => RuleContext rtype sub -> Rule super rtype (State sub)
liftSTS :: STS sts => BaseM sts a -> Rule sts ctx a

-- | Control which assertions are enabled.
data AssertionPolicy
AssertionsAll :: AssertionPolicy

-- | Only run preconditions
AssertionsPre :: AssertionPolicy

-- | Only run postconditions
AssertionsPost :: AssertionPolicy
AssertionsOff :: AssertionPolicy

-- | Control which predicates are evaluated during rule processing.
data ValidationPolicy
ValidateAll :: ValidationPolicy
ValidateNone :: ValidationPolicy
data ApplySTSOpts
ApplySTSOpts :: AssertionPolicy -> ValidationPolicy -> ApplySTSOpts

-- | Enable assertions during STS processing. If this option is enabled,
--   STS processing will terminate on violation of an assertion.
[asoAssertions] :: ApplySTSOpts -> AssertionPolicy

-- | Validation policy
[asoValidation] :: ApplySTSOpts -> ValidationPolicy

-- | Apply an STS with options. Note that this returns both the final state
--   and the list of predicate failures.
applySTSOpts :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => ApplySTSOpts -> RuleContext rtype s -> m (State s, [[PredicateFailure s]])
applySTS :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m (Either [[PredicateFailure s]] (State s))
applySTSIndifferently :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m (State s, [[PredicateFailure s]])

-- | Re-apply an STS.
--   
--   It is assumed that the caller of this function has previously applied
--   this STS, and can guarantee that it completed successfully. No
--   predicates will be checked when calling this function.
reapplySTS :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m (State s)

-- | This can be used to specify predicate failures in STS rules where a
--   value is beyond a certain threshold.
--   
--   TODO move this somewhere more sensible
newtype Threshold a
Threshold :: a -> Threshold a
instance GHC.Show.Show Control.State.Transition.Extended.AssertionPolicy
instance GHC.Classes.Eq Control.State.Transition.Extended.AssertionPolicy
instance GHC.Show.Show Control.State.Transition.Extended.ValidationPolicy
instance GHC.Classes.Eq Control.State.Transition.Extended.ValidationPolicy
instance GHC.Show.Show Control.State.Transition.Extended.ApplySTSOpts
instance GHC.Classes.Eq Control.State.Transition.Extended.ApplySTSOpts
instance NoThunks.Class.NoThunks a => NoThunks.Class.NoThunks (Control.State.Transition.Extended.Threshold a)
instance Data.Data.Data a => Data.Data.Data (Control.State.Transition.Extended.Threshold a)
instance GHC.Show.Show a => GHC.Show.Show (Control.State.Transition.Extended.Threshold a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Control.State.Transition.Extended.Threshold a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Control.State.Transition.Extended.Threshold a)
instance (GHC.Show.Show (Control.State.Transition.Extended.Environment sts), GHC.Show.Show (Control.State.Transition.Extended.State sts), GHC.Show.Show (Control.State.Transition.Extended.Signal sts)) => GHC.Show.Show (Control.State.Transition.Extended.TRC sts)
instance GHC.Base.Functor (Control.State.Transition.Extended.Clause sts rtype)
instance Control.State.Transition.Extended.STS sts => GHC.Show.Show (Control.State.Transition.Extended.AssertionViolation sts)
instance Control.State.Transition.Extended.STS sts => GHC.Exception.Type.Exception (Control.State.Transition.Extended.AssertionViolation sts)
instance Control.State.Transition.Extended.STS sts => Control.State.Transition.Extended.Embed sts sts
instance Control.State.Transition.Extended.RuleTypeRep 'Control.State.Transition.Extended.Initial
instance Control.State.Transition.Extended.RuleTypeRep 'Control.State.Transition.Extended.Transition


-- | Simple state transition system over the Identity monad.
module Control.State.Transition.Simple
applySTSIndifferently :: forall s rtype. (STS s, RuleTypeRep rtype, Identity ~ BaseM s) => RuleContext rtype s -> (State s, [[PredicateFailure s]])
applySTS :: forall s rtype. (STS s, RuleTypeRep rtype, BaseM s ~ Identity) => RuleContext rtype s -> Either [[PredicateFailure s]] (State s)

-- | This can be used to specify predicate failures in STS rules where a
--   value is beyond a certain threshold.
--   
--   TODO move this somewhere more sensible
newtype Threshold a
Threshold :: a -> Threshold a
data ApplySTSOpts
ApplySTSOpts :: AssertionPolicy -> ValidationPolicy -> ApplySTSOpts

-- | Enable assertions during STS processing. If this option is enabled,
--   STS processing will terminate on violation of an assertion.
[asoAssertions] :: ApplySTSOpts -> AssertionPolicy

-- | Validation policy
[asoValidation] :: ApplySTSOpts -> ValidationPolicy

-- | Control which predicates are evaluated during rule processing.
data ValidationPolicy
ValidateAll :: ValidationPolicy
ValidateNone :: ValidationPolicy

-- | Control which assertions are enabled.
data AssertionPolicy
AssertionsAll :: AssertionPolicy

-- | Only run preconditions
AssertionsPre :: AssertionPolicy

-- | Only run postconditions
AssertionsPost :: AssertionPolicy
AssertionsOff :: AssertionPolicy
type Rule sts rtype = F (Clause sts rtype)

-- | Embed one STS within another.
class (STS sub, BaseM sub ~ BaseM super) => Embed sub super

-- | Wrap a predicate failure of the subsystem in a failure of the
--   super-system.
wrapFailed :: Embed sub super => PredicateFailure sub -> PredicateFailure super

-- | State transition system.
class (Eq (PredicateFailure a), Show (PredicateFailure a), Monad (BaseM a), Typeable a) => STS a where {
    
    -- | Type of the state which the system transitions between.
    type family State a :: Type;
    
    -- | Signal triggering a state change.
    type family Signal a :: Type;
    
    -- | Environment type.
    type family Environment a :: Type;
    
    -- | Monad into which to interpret the rules.
    type family BaseM a :: Type -> Type;
    
    -- | Descriptive type for the possible failures which might cause a
    --   transition to fail.
    --   
    --   As a convention, <a>PredicateFailure</a>s which are "structural"
    --   (meaning that they are not "throwable" in practice, and are used to
    --   pass control from one transition rule to another) are prefixed with
    --   <tt>S_</tt>.
    --   
    --   Structural <a>PredicateFailure</a>s represent conditions between rules
    --   where the disjunction of all rules' preconditions is equal to
    --   <a>True</a>. That is, either one rule will throw a structural
    --   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
    type family PredicateFailure a = (b :: Type) | b -> a;
    type BaseM a = Identity;
}

-- | Rules governing transition under this system.
initialRules :: STS a => [InitialRule a]
transitionRules :: STS a => [TransitionRule a]

-- | Assertions about the transition system.
assertions :: STS a => [Assertion a]

-- | Render an assertion violation.
--   
--   Defaults to using <a>show</a>, but note that this does not know how to
--   render the context. So for more information you should define your own
--   renderer here.
renderAssertionViolation :: STS a => AssertionViolation a -> String
data AssertionViolation sts
AssertionViolation :: String -> String -> TRC sts -> Maybe (State sts) -> AssertionViolation sts
[avSTS] :: AssertionViolation sts -> String
[avMsg] :: AssertionViolation sts -> String
[avCtx] :: AssertionViolation sts -> TRC sts
[avState] :: AssertionViolation sts -> Maybe (State sts)

-- | An assertion is a validation condition for the STS system in question.
--   It should be used to define properties of the system as a whole that
--   cannot be violated under normal circumstances - e.g. a violation
--   implies a failing in the rule logic.
--   
--   Assertions should not check for conditions that may differ between
--   different rules in a system, since the interpreter may stop the system
--   upon presence of a failed assertion.
--   
--   Whether assertions are checked is a matter for the STS interpreter.
data Assertion sts

-- | Pre-condition. Checked before the rule fires.
PreCondition :: String -> (TRC sts -> Bool) -> Assertion sts

-- | Post-condition. Checked after the rule fires, and given access to the
--   resultant state as well as the initial context.
PostCondition :: String -> (TRC sts -> State sts -> Bool) -> Assertion sts
type TransitionRule sts = Rule sts 'Transition (State sts)
type InitialRule sts = Rule sts 'Initial (State sts)
type family RuleContext (t :: RuleType) = (ctx :: Type -> Type) | ctx -> t

-- | Context available to transition rules.
newtype TRC sts
TRC :: (Environment sts, State sts, Signal sts) -> TRC sts

-- | Context available to initial rules.
newtype IRC sts
IRC :: Environment sts -> IRC sts
class RuleTypeRep t
data RuleType
Initial :: RuleType
Transition :: RuleType

-- | Oh noes!
--   
--   This takes a condition (a boolean expression) and a failure and
--   results in a clause which will throw that failure if the condition
--   fails.
(?!) :: Bool -> PredicateFailure sts -> Rule sts ctx ()
infix 1 ?!
failBecause :: PredicateFailure sts -> Rule sts ctx ()

-- | Oh noes with an explanation
--   
--   We interpret this as "What?" "No!" "Because:"
(?!:) :: Either e () -> (e -> PredicateFailure sts) -> Rule sts ctx ()
trans :: Embed sub super => RuleContext rtype sub -> Rule super rtype (State sub)
liftSTS :: STS sts => BaseM sts a -> Rule sts ctx a

-- | Get the judgment context
judgmentContext :: Rule sts rtype (RuleContext rtype sts)

-- | Apply an STS with options. Note that this returns both the final state
--   and the list of predicate failures.
applySTSOpts :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => ApplySTSOpts -> RuleContext rtype s -> m (State s, [[PredicateFailure s]])

-- | Re-apply an STS.
--   
--   It is assumed that the caller of this function has previously applied
--   this STS, and can guarantee that it completed successfully. No
--   predicates will be checked when calling this function.
reapplySTS :: forall s m rtype. (STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m (State s)


-- | Small step state transition systems.
module Control.State.Transition


-- | An approach to computing the abstract size of data using
--   <a>TypeRep</a>.
module Data.AbstractSize

-- | The <a>typeReps</a> function retrieves all the type representations
--   found while traversing the data given as parameter.
--   
--   CAUTION: for newtypes, do not use 'deriving newtype (HasTypeReps)' to
--   derive instances, rather use 'deriving anyclass (HasTypeReps)'. This
--   is because we use these instances in <a>abstractSize</a>, and for that
--   we prefer to have the newtype wrapper type available for "costing".
--   The difference between 'newtype' and <tt>anyclass</tt> instances is as
--   follows:
--   
--   newtype Hash = Hash { unHash :: Int } deriving newtype (...,
--   HasTypeReps) &gt; typeReps someHash = Seq.fromList [Int] vs newtype
--   Hash = Hash { unHash :: Int } deriving stock (...,Generics); deriving
--   anyclass (HasTypeReps) &gt; typeReps someHash = Seq.fromList [Hash,
--   Int]
--   
--   Examples:
--   
--   <pre>
--   &gt;&gt;&gt; typeReps "a"
--   fromList [[Char],Char]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; typeReps "ab"
--   fromList [[Char],Char,Char]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; typeReps ([] :: [Int])
--   fromList [[Int]]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; :set -XDeriveGeneric
--   
--   &gt;&gt;&gt; data Foo = Foo [Int] (Char, Char) deriving (Generic)
--   
--   &gt;&gt;&gt; instance HasTypeReps Foo
--   
--   &gt;&gt;&gt; typeReps $ Foo [1, 2] ('a', 'b')
--   fromList [Foo,[Int],Int,Int,(Char,Char),Char,Char]
--   </pre>
class HasTypeReps a
typeReps :: HasTypeReps a => a -> Seq TypeRep

-- | <tt>abstractSize m a</tt> computes the abstract size of <tt>a</tt>,
--   using the accounting map <tt>m</tt>. The map <tt>m</tt> determines the
--   abstract size of each <a>TypeRep</a> contained in <tt>a</tt>, and this
--   function simply adds all the individual abstract sizes. To be able to
--   extract the type representations (<a>TypeRep</a>s) inside <tt>a</tt>,
--   we require it to be an instance of <a>HasTypeReps</a>.
--   
--   Examples:
--   
--   <pre>
--   &gt;&gt;&gt; :set -XOverloadedLists
--   
--   &gt;&gt;&gt; abstractSize [(typeOf (undefined:: Char), 10)] 'a'
--   10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; abstractSize [(typeOf 'x', 10)] "hello"
--   50
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; abstractSize [(typeOf 'x', 10), (typeOf True, 100)] ("hello", False)
--   150
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; abstractSize [(typeOf (undefined :: [Int]), 6), (typeOf (1 :: Int), 1)] ([0, 1, 2, 3] :: [Int])
--   10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; abstractSize [(typeOf (undefined :: [Int]), 3), (typeOf (1 :: Int), -1)] ([0, 1, 2] :: [Int])
--   0
--   </pre>
abstractSize :: HasTypeReps a => AccountingMap -> a -> Size
type AccountingMap = Map TypeRep Size
type Size = Int
instance Data.AbstractSize.HasTypeReps a => Data.AbstractSize.GHasTypeReps (GHC.Generics.K1 i a)
instance (Data.Typeable.Internal.Typeable a, Data.AbstractSize.HasTypeReps a) => Data.AbstractSize.HasTypeReps (GHC.Maybe.Maybe a)
instance (Data.Typeable.Internal.Typeable a, Data.AbstractSize.HasTypeReps a) => Data.AbstractSize.HasTypeReps [a]
instance (Data.Typeable.Internal.Typeable a, Data.AbstractSize.HasTypeReps a) => Data.AbstractSize.HasTypeReps (Data.Set.Internal.Set a)
instance (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b, Data.AbstractSize.HasTypeReps a, Data.AbstractSize.HasTypeReps b) => Data.AbstractSize.HasTypeReps (a, b)
instance Data.AbstractSize.HasTypeReps GHC.Types.Bool
instance Data.AbstractSize.HasTypeReps GHC.Types.Char
instance Data.AbstractSize.HasTypeReps GHC.Types.Int
instance Data.AbstractSize.HasTypeReps GHC.Integer.Type.Integer
instance Data.AbstractSize.HasTypeReps GHC.Types.Double
instance Data.AbstractSize.HasTypeReps GHC.Natural.Natural
instance Data.AbstractSize.HasTypeReps GHC.Types.Word
instance Data.AbstractSize.HasTypeReps GHC.Word.Word8
instance Data.AbstractSize.HasTypeReps GHC.Word.Word16
instance Data.AbstractSize.HasTypeReps GHC.Word.Word32
instance Data.AbstractSize.HasTypeReps GHC.Word.Word64
instance Data.AbstractSize.HasTypeReps (Crypto.Hash.Types.Digest Crypto.Hash.SHA256.SHA256)
instance Data.AbstractSize.HasTypeReps Cardano.Crypto.Hash.Short.ShortHash
instance Data.Typeable.Internal.Typeable a => Data.AbstractSize.HasTypeReps (Cardano.Crypto.Hash.Class.Hash Cardano.Crypto.Hash.Short.ShortHash a)
instance Data.AbstractSize.HasTypeReps (Cardano.Crypto.DSIGN.Class.SignedDSIGN Cardano.Crypto.DSIGN.Mock.MockDSIGN a)
instance Data.AbstractSize.HasTypeReps (Cardano.Crypto.DSIGN.Class.VerKeyDSIGN Cardano.Crypto.DSIGN.Mock.MockDSIGN)
instance Data.AbstractSize.GHasTypeReps GHC.Generics.U1
instance (Data.AbstractSize.GHasTypeReps a, Data.AbstractSize.GHasTypeReps b) => Data.AbstractSize.GHasTypeReps (a GHC.Generics.:*: b)
instance (Data.AbstractSize.GHasTypeReps a, Data.AbstractSize.GHasTypeReps b) => Data.AbstractSize.GHasTypeReps (a GHC.Generics.:+: b)
instance Data.AbstractSize.GHasTypeReps a => Data.AbstractSize.GHasTypeReps (GHC.Generics.M1 i c a)

module Data.CannonicalMaps
class Eq t => CannonicalZero t
zeroC :: CannonicalZero t => t
joinC :: CannonicalZero t => t -> t -> t
cannonicalInsert :: (Ord k, CannonicalZero a) => (a -> a -> a) -> k -> a -> Map k a -> Map k a
cannonicalMapUnion :: (Ord k, CannonicalZero a) => (a -> a -> a) -> Map k a -> Map k a -> Map k a
cannonicalMap :: (Ord k, CannonicalZero a) => (a -> a) -> Map k a -> Map k a
pointWise :: (Ord k, CannonicalZero v) => (v -> v -> Bool) -> Map k v -> Map k v -> Bool

-- | A Map from keys <tt>k</tt> to values <tt>a</tt>.
--   
--   The <a>Semigroup</a> operation for <a>Map</a> is <a>union</a>, which
--   prefers values from the left operand. If <tt>m1</tt> maps a key
--   <tt>k</tt> to a value <tt>a1</tt>, and <tt>m2</tt> maps the same key
--   to a different value <tt>a2</tt>, then their union <tt>m1 &lt;&gt;
--   m2</tt> maps <tt>k</tt> to <tt>a1</tt>.
data Map k a
instance Data.CannonicalMaps.CannonicalZero GHC.Integer.Type.Integer
instance (GHC.Classes.Eq k, GHC.Classes.Eq v, GHC.Classes.Ord k, Data.CannonicalMaps.CannonicalZero v) => Data.CannonicalMaps.CannonicalZero (Data.Map.Internal.Map k v)


-- | MemoBytes is an abstration for a datetype that encodes its own
--   seriialization. The idea is to use a newtype around a MemoBytes
--   non-memoizing version. For example: newtype Foo = Foo(MemoBytes
--   NonMemoizingFoo) This way all the instances for Foo
--   (Eq,Show,Ord,ToCBOR,FromCBOR,NoThunks,Generic) can be derived for
--   free.
module Data.Coders
data Encode (w :: Wrapped) t
[Rec] :: t -> Encode ('Closed 'Dense) t
[Sum] :: t -> Word -> Encode 'Open t
[Keyed] :: t -> Encode ('Closed 'Sparse) t
[To] :: ToCBOR a => a -> Encode ('Closed 'Dense) a
[E] :: (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
[ED] :: Dual t -> t -> Encode ('Closed 'Dense) t
[OmitC] :: t -> Encode w t
[Omit] :: (t -> Bool) -> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
[Key] :: Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
[ApplyE] :: Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
data Decode (w :: Wrapped) t
[Summands] :: String -> (Word -> Decode 'Open t) -> Decode ('Closed 'Dense) t
[SparseKeyed] :: Typeable t => String -> t -> (Word -> Field t) -> [(Word, String)] -> Decode ('Closed 'Dense) t
[SumD] :: t -> Decode 'Open t
[RecD] :: t -> Decode ('Closed 'Dense) t
[KeyedD] :: t -> Decode ('Closed 'Sparse) t
[From] :: FromCBOR t => Decode w t
[D] :: (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
[ApplyD] :: Decode w1 (a -> t) -> Decode ('Closed d) a -> Decode w1 t
[Invalid] :: Word -> Decode w t
[Map] :: (a -> b) -> Decode w a -> Decode w b
[DD] :: Dual t -> Decode ('Closed 'Dense) t
[Emit] :: t -> Decode w t
[Ann] :: Decode w t -> Decode w (Annotator t)
[ApplyAnn] :: Decode w1 (Annotator (a -> t)) -> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
(!>) :: Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
infixl 4 !>
(<!) :: Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
infixl 4 <!
(<*!) :: Decode w1 (Annotator (a -> t)) -> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
infixl 4 <*!

-- | Some CBOR instances wrap encoding sequences with prefixes and
--   suffixes. I.e. prefix , encode, encode, encode , ... , suffix. There
--   are two kinds of wrapping coders: Nary sums, and Sparsely encoded
--   products. Coders in these classes can only be decoded when they are
--   wrapped by their closing forms Summand and SparseKeyed. In another
--   dimension records can be encoded densely (all their fields serialised)
--   or sparsely (only some of their fields). We use indexes to types to
--   try and mark (and enforce) these distinctions.
--   
--   Record density (all the fields) vs (some of the fields)
data Density
Dense :: Density
Sparse :: Density
data Wrapped
[Open] :: Wrapped
[Closed] :: Density -> Wrapped

-- | A value of type `Annotator a` is one that needs access to the entire |
--   bytestring used during decoding to finish construction.
newtype Annotator a
Annotator :: (FullByteString -> a) -> Annotator a
[runAnnotator] :: Annotator a -> FullByteString -> a

-- | Analogous to paired ToCBOR and FromCBOR instances with out freezing
--   out alternate ways to code. Unlike ToCBOR and FromCBOR where there is
--   only one instance per type. There can be multiple Duals with the same
--   type.
data Dual t
Dual :: (t -> Encoding) -> (forall s. Decoder s t) -> Dual t

-- | A Field pairs an update function and a decoder for one field of a
--   Sparse record.
data Field t
[Field] :: (x -> t -> t) -> (forall s. Decoder s x) -> Field t
field :: (x -> t -> t) -> Decode ('Closed d) x -> Field t
encode :: Encode w t -> Encoding
decode :: Decode w t -> Decoder s t
runE :: Encode w t -> t
decodeList :: Decoder s a -> Decoder s [a]
decodeSeq :: Decoder s a -> Decoder s (Seq a)
decodeStrictSeq :: Decoder s a -> Decoder s (StrictSeq a)
decodeSet :: Ord a => Decoder s a -> Decoder s (Set a)
decodeRecordNamed :: Text -> (a -> Int) -> Decoder s a -> Decoder s a
decodeRecordSum :: String -> (Word -> Decoder s (Int, a)) -> Decoder s a
invalidKey :: Word -> Decoder s a
unusedRequiredKeys :: Set Word -> [(Word, String)] -> String -> Decoder s a
duplicateKey :: String -> Word -> Decoder s a
wrapCBORArray :: Word -> Encoding -> Encoding
encodeFoldable :: (ToCBOR a, Foldable f) => f a -> Encoding
decodeCollectionWithLen :: Decoder s (Maybe Int) -> Decoder s a -> Decoder s (Int, [a])
decodeCollection :: Decoder s (Maybe Int) -> Decoder s a -> Decoder s [a]
encodeFoldableEncoder :: Foldable f => (a -> Encoding) -> f a -> Encoding
dualList :: (ToCBOR a, FromCBOR a) => Dual [a]
dualSeq :: (ToCBOR a, FromCBOR a) => Dual (Seq a)
dualSet :: (Ord a, ToCBOR a, FromCBOR a) => Dual (Set a)

-- | Good for encoding (Maybe t) if is another Maybe. Uses more space than
--   dualMaybeAsNull
dualMaybeAsList :: (ToCBOR a, FromCBOR a) => Dual (Maybe a)

-- | Good for encoding (Maybe T) as long as T isn't another Maybe
dualMaybeAsNull :: (ToCBOR a, FromCBOR a) => Dual (Maybe a)
dualText :: Dual Text
dualStrictSeq :: (ToCBOR a, FromCBOR a) => Dual (StrictSeq a)
dualCBOR :: (ToCBOR a, FromCBOR a) => Dual a
to :: (ToCBOR t, FromCBOR t) => t -> Encode ('Closed 'Dense) t
from :: (ToCBOR t, FromCBOR t) => Decode ('Closed 'Dense) t

-- | A continuation-based decoder, used for decoding values that were
--   previously encoded using the <a>Codec.CBOR.Encoding</a> module. As
--   <a>Decoder</a> has a <a>Monad</a> instance, you can easily write
--   <a>Decoder</a>s monadically for building your deserialisation logic.
data Decoder s a

-- | An intermediate form used during serialisation, specified as a
--   <a>Monoid</a>. It supports efficient concatenation, and is equivalent
--   to a specialised <a>Endo</a> <a>Tokens</a> type.
--   
--   It is used for the stage in serialisation where we flatten out the
--   Haskell data structure but it is independent of any specific external
--   binary or text format.
--   
--   Traditionally, to build any arbitrary <a>Encoding</a> value, you
--   specify larger structures from smaller ones and append the small ones
--   together using <a>mconcat</a>.
data Encoding
encodeNullMaybe :: (a -> Encoding) -> Maybe a -> Encoding
decodeNullMaybe :: Decoder s a -> Decoder s (Maybe a)
decodeSparse :: Typeable a => String -> a -> (Word -> Field a) -> [(Word, String)] -> Decoder s a
instance GHC.Base.Functor (Data.Coders.Decode w)
instance GHC.Base.Applicative (Data.Coders.Decode ('Data.Coders.Closed d))

module Control.Iterate.SetAlgebra

-- | In order to build typed Exp (which are a typed deep embedding) of Set
--   operations, we need to know what kind of basic types of Maps and Sets
--   can be embedded. Every Basic type has a few operations for creating
--   one from a list, for adding and removing key-value pairs, looking up a
--   value given a key. Instances of this algebra are functional in that
--   every key has exactly one value associated with it.
--   ===================================================================================================
class Iter f => Basic f

-- | in addpair the new value always prevails, to make a choice use
--   <a>addkv</a> which has a combining function that allows choice.
addpair :: (Basic f, Ord k) => k -> v -> f k v -> f k v

-- | use ( old new -&gt; old) if you want the v in (f k v) to prevail, and
--   use ( old new -&gt; new) if you want the v in (k,v) to prevail
addkv :: (Basic f, Ord k) => (k, v) -> f k v -> (v -> v -> v) -> f k v
removekey :: (Basic f, Ord k) => k -> f k v -> f k v
domain :: (Basic f, Ord k) => f k v -> Set k
range :: (Basic f, Ord v) => f k v -> Set v
emptyc :: (Basic f, Ord k) => f k v
fromPairs :: Ord k => (v -> v -> v) -> [(k, v)] -> List k v
normalize :: Ord k => (v -> v -> v) -> [(k, v)] -> [(k, v)]
data Single k v
[Single] :: k -> v -> Single k v
[Fail] :: Single k v
[SetSingle] :: k -> Single k ()
mapflip :: (v -> v -> v) -> v -> v -> v
data BiMap v a b
[MkBiMap] :: v ~ b => !Map a b -> !Map b (Set a) -> BiMap v a b

-- | Decode a serialised CBOR Map as a Bimap
decodeMapAsBimap :: (FromCBOR a, FromCBOR b, Ord a, Ord b) => Decoder s (BiMap b a b)
addBack :: (Ord v, Ord k) => v -> k -> Map v (Set k) -> Map v (Set k)
retract :: (Ord v, Ord k) => v -> k -> Map v (Set k) -> Map v (Set k)
insertBackwards :: (Ord k, Ord v) => v -> v -> k -> Map v (Set k) -> Map v (Set k)
biMapEmpty :: BiMap v k v
biMapFromList :: (Ord k, Ord v) => (v -> v -> v) -> [(k, v)] -> BiMap v k v
biMapFromAscDistinctList :: (Ord k, Ord v) => [(k, v)] -> BiMap v k v
type Bimap k v = BiMap v k v
removeval :: (Ord k, Ord v) => v -> BiMap v k v -> BiMap v k v
data Sett k v
[Sett] :: Set k -> Sett k ()
class Embed concrete base | concrete -> base
toBase :: Embed concrete base => concrete -> base
fromBase :: Embed concrete base => base -> concrete
class Iter f
nxt :: Iter f => f a b -> Collect (a, b, f a b)
lub :: (Iter f, Ord k) => k -> f k b -> Collect (k, b, f k b)
hasNxt :: Iter f => f a b -> Maybe (a, b, f a b)
hasLub :: (Iter f, Ord k) => k -> f k b -> Maybe (k, b, f k b)
haskey :: (Iter f, Ord key) => key -> f key b -> Bool
isnull :: Iter f => f k v -> Bool
lookup :: (Iter f, Ord key) => key -> f key rng -> Maybe rng
element :: (Iter f, Ord k) => k -> f k v -> Collect ()
data List k v
[UnSafeList] :: Ord k => [(k, v)] -> List k v
unList :: List k v -> [(k, v)]
noKeys :: Ord k => Map k a -> Map k b -> Map k a
keysEqual :: Ord k => Map k v1 -> Map k v2 -> Bool
sameDomain :: (Ord k, Iter f, Iter g) => f k b -> g k c -> Bool

-- | A variant of <tt>splitLookup</tt> that indicates only whether the key
--   was present, rather than producing its value. This is used to
--   implement <a>keysEqual</a> to avoid allocating unnecessary <a>Just</a>
--   constructors.
splitMember :: Ord k => k -> Map k a -> (Map k a, Bool, Map k a)
data StrictTriple a b c
StrictTriple :: !a -> !b -> !c -> StrictTriple a b c

-- | intersetDomP p m1 m2 == Keep the key and value from m2, iff (the key
--   is in the dom of m1) &amp;&amp; ((p key value) is true)
intersectDomP :: Ord k => (k -> v2 -> Bool) -> Map k v1 -> Map k v2 -> Map k v2

-- | <ul>
--   <li>Similar to intersectDomP, except the Map returned has the same key
--   as the first input map, rather than the second input map.</li>
--   </ul>
intersectDomPLeft :: Ord k => (k -> v2 -> Bool) -> Map k v1 -> Map k v2 -> Map k v1

-- | <ul>
--   <li>fold over the intersection of a Map and a Set</li>
--   </ul>
intersectMapSetFold :: Ord k => (k -> v -> ans -> ans) -> Map k v -> Set k -> ans -> ans

-- | Fold with <tt>accum</tt> all those pairs in the map, not appearing in
--   the set.
disjointMapSetFold :: Ord k => (k -> v -> ans -> ans) -> Map k v -> Set k -> ans -> ans
data BaseRep f k v
[MapR] :: Basic Map => BaseRep Map k v
[SetR] :: Basic Sett => BaseRep Sett k ()
[ListR] :: Basic List => BaseRep List k v
[SingleR] :: Basic Single => BaseRep Single k v
[BiMapR] :: (Basic (BiMap v), Ord v) => BaseRep (BiMap v) k v
lifo :: Iter f => f k v -> Collect (k, v)
fifo :: Iter f => f k v -> Collect (k, v)

-- | The self typed GADT: Exp, that encodes the shape of Set expressions. A
--   deep embedding. Exp is a typed Symbolic representation of queries we
--   may ask. It allows us to introspect a query The strategy is to 1)
--   Define Exp so all queries can be represented. 2) Define smart
--   constructors that "parse" the surface syntax, and build a typed Exp 3)
--   Write an evaluate function: eval:: Exp t -&gt; t 4) "eval" can
--   introspect the code and apply efficient domain and type specific
--   translations 5) Use the (Iter f) class to evaluate some Exp that can
--   benefit from its efficient nature.
--   ===============================================================================================
data Exp t
[Base] :: (Ord k, Basic f) => BaseRep f k v -> f k v -> Exp (f k v)
[Dom] :: Ord k => Exp (f k v) -> Exp (Sett k ())
[Rng] :: (Ord k, Ord v) => Exp (f k v) -> Exp (Sett v ())
[DRestrict] :: (Ord k, Iter g) => Exp (g k ()) -> Exp (f k v) -> Exp (f k v)
[DExclude] :: (Ord k, Iter g) => Exp (g k ()) -> Exp (f k v) -> Exp (f k v)
[RRestrict] :: (Ord k, Iter g, Ord v) => Exp (f k v) -> Exp (g v ()) -> Exp (f k v)
[RExclude] :: (Ord k, Iter g, Ord v) => Exp (f k v) -> Exp (g v ()) -> Exp (f k v)
[Elem] :: (Ord k, Iter g, Show k) => k -> Exp (g k ()) -> Exp Bool
[NotElem] :: (Ord k, Iter g, Show k) => k -> Exp (g k ()) -> Exp Bool
[Intersect] :: (Ord k, Iter f, Iter g) => Exp (f k v) -> Exp (g k u) -> Exp (Sett k ())
[Subset] :: (Ord k, Iter f, Iter g) => Exp (f k v) -> Exp (g k u) -> Exp Bool
[SetDiff] :: (Ord k, Iter f, Iter g) => Exp (f k v) -> Exp (g k u) -> Exp (f k v)
[UnionOverrideLeft] :: (Show k, Show v, Ord k) => Exp (f k v) -> Exp (g k v) -> Exp (f k v)
[UnionPlus] :: (Ord k, Monoid n) => Exp (f k n) -> Exp (f k n) -> Exp (f k n)
[UnionOverrideRight] :: Ord k => Exp (f k v) -> Exp (g k v) -> Exp (f k v)
[Singleton] :: Ord k => k -> v -> Exp (Single k v)
[SetSingleton] :: Ord k => k -> Exp (Single k ())
[KeyEqual] :: (Ord k, Iter f, Iter g) => Exp (f k v) -> Exp (g k u) -> Exp Bool
dRestrict :: (Ord k, Iter g) => Exp (g k ()) -> Exp (f k v) -> Exp (f k v)
rRestrict :: (Ord k, Iter g, Ord v) => Exp (f k v) -> Exp (g v ()) -> Exp (f k v)
dExclude :: (Ord k, Iter g) => Exp (g k ()) -> Exp (f k v) -> Exp (f k v)
rExclude :: (Ord k, Iter g, Ord v) => Exp (f k v) -> Exp (g v ()) -> Exp (f k v)

-- | Basic types are those that can be embedded into Exp. The HasExp class,
--   encodes how to lift a Basic type into an Exp. The function
--   <a>toExp</a> will build a typed Exp for that Basic type. This will be
--   really usefull in the smart constructors.
--   ==================================================================
class HasExp s t | s -> t
toExp :: HasExp s t => s -> Exp t
dom :: (Ord k, HasExp s (f k v)) => s -> Exp (Sett k ())
rng :: (Ord k, Ord v) => HasExp s (f k v) => s -> Exp (Sett v ())
(◁) :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(<|) :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
drestrict :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(⋪) :: (Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
dexclude :: (Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(▷) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(|>) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
rrestrict :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(⋫) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
rexclude :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(∈) :: (Show k, Ord k, Iter g, HasExp s (g k ())) => k -> s -> Exp Bool
(∉) :: (Show k, Ord k, Iter g, HasExp s (g k ())) => k -> s -> Exp Bool
notelem :: (Show k, Ord k, Iter g, HasExp s (g k ())) => k -> s -> Exp Bool
(∪) :: (Show k, Show v, Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
unionleft :: (Show k, Show v, Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
(⨃) :: (Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
unionright :: (Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
(∪+) :: (Ord k, Monoid n, HasExp s1 (f k n), HasExp s2 (f k n)) => s1 -> s2 -> Exp (f k n)
unionplus :: (Ord k, Monoid n, HasExp s1 (f k n), HasExp s2 (f k n)) => s1 -> s2 -> Exp (f k n)
singleton :: Ord k => k -> v -> Exp (Single k v)
setSingleton :: Ord k => k -> Exp (Single k ())
(∩) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (Sett k ())
intersect :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (Sett k ())
(⊆) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
subset :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
(➖) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (f k v)
setdiff :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (f k v)
(≍) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
keyeq :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool

-- | Symbolc functions (Fun) are data, that can be pattern matched over.
--   They 1) Represent a wide class of binary functions that are used in
--   translating the SetAlgebra 2) Turned into a String so they can be
--   printed 3) Turned into the function they represent. 4) Composed into
--   bigger functions 5) Symbolically symplified Here we implement Symbolic
--   Binary functions with upto 4 variables, which is enough for this use
--   =================================================================================================
data Pat env t
[P1] :: Pat (d, c, b, a) d
[P2] :: Pat (d, c, b, a) c
[P3] :: Pat (d, c, b, a) b
[P4] :: Pat (d, c, b, a) a
[PPair] :: Pat (d, c, b, a) a -> Pat (d, c, b, a) b -> Pat (d, c, b, a) (a, b)
data Expr env t
[X1] :: Expr (d, c, b, a) d
[X2] :: Expr (d, c, b, a) c
[X3] :: Expr (d, c, b, a) b
[X4] :: Expr (d, c, b, a) a
[HasKey] :: (Iter f, Ord k) => Expr e k -> f k v -> Expr e Bool
[Neg] :: Expr e Bool -> Expr e Bool
[Ap] :: Lam (a -> b -> c) -> Expr e a -> Expr e b -> Expr e c
[EPair] :: Expr e a -> Expr e b -> Expr e (a, b)
[FST] :: Expr e (a, b) -> Expr e a
[SND] :: Expr e (a, b) -> Expr e b
[Lit] :: Show t => t -> Expr env t
data Lam t
[Lam] :: Pat (d, c, b, a) t -> Pat (d, c, b, a) s -> Expr (d, c, b, a) v -> Lam (t -> s -> v)
[Add] :: Num n => Lam (n -> n -> n)
[Cat] :: Monoid m => Lam (m -> m -> m)
[Eql] :: Eq t => Lam (t -> t -> Bool)
[Both] :: Lam (Bool -> Bool -> Bool)
[Lift] :: (a -> b -> c) -> Lam (a -> b -> c)
type StringEnv = (String, String, String, String)
bindE :: Pat (a, b, c, d) t -> Expr (w, x, y, z) t -> StringEnv -> StringEnv
showE :: StringEnv -> Expr (a, b, c, d) t -> String
showL :: StringEnv -> Lam t -> String
showP :: StringEnv -> Pat any t -> String
data Fun t
Fun :: Lam t -> t -> Fun t
apply :: Fun t -> t
first :: Fun (v -> s -> v)
second :: Fun (v -> s -> s)
plus :: Monoid t => Fun (t -> t -> t)
eql :: Eq t => Fun (t -> t -> Bool)
constant :: Show c => c -> Fun (a -> b -> c)
rngElem :: (Ord rng, Iter f) => f rng v -> Fun (dom -> rng -> Bool)
domElem :: (Ord dom, Iter f) => f dom v -> Fun (dom -> rng -> Bool)
rngFst :: Fun (x -> (a, b) -> a)
rngSnd :: Fun (x -> (a, b) -> b)
compose1 :: Fun (t1 -> t2 -> t3) -> Fun (t1 -> t4 -> t2) -> Fun (t1 -> t4 -> t3)
compSndL :: Fun (k -> (a, b) -> c) -> Fun (k -> d -> a) -> Fun (k -> (d, b) -> c)
compSndR :: Fun (k -> (a, b) -> c) -> Fun (k -> d -> b) -> Fun (k -> (a, d) -> c)
compCurryR :: Fun (k -> (a, b) -> d) -> Fun (a -> c -> b) -> Fun (k -> (a, c) -> d)
nEgate :: Fun (k -> v -> Bool) -> Fun (k -> v -> Bool)
always :: Fun (a -> b -> Bool)
both :: Fun (a -> b -> Bool) -> Fun (a -> b -> Bool) -> Fun (a -> b -> Bool)
lift :: (a -> b -> c) -> Fun (a -> b -> c)

-- | Given a BaseRep we can materialize a (Collect k v) into the type
--   witnessed by the BaseRep. Recall a (Collect k v) has no intrinsic type
--   (it is just an ABSTRACT sequence of tuples), so the witness describes
--   how to turn them into the chosen datatype. Note that materialize is
--   meant to be applied to a collection built by iterating over a Query.
--   This produces the keys in ascending order, with no duplicate keys. So
--   we do not need to specify how to merge values.
--   =============================================================================================
materialize :: Ord k => BaseRep f k v -> Collect (k, v) -> f k v
addp :: (Ord k, Basic f) => (v -> v -> v) -> (k, v) -> f k v -> f k v
fromList :: Ord k => BaseRep f k v -> (v -> v -> v) -> [(k, v)] -> f k v
(⨝) :: (Ord k, Iter f, Iter g) => f k b -> g k c -> Collect (k, b, c)
domEq :: (Ord k, Iter f, Iter g) => f k b -> g k c -> Collect (k, b, c)
domEqSlow :: (Ord k, Iter f, Iter g) => f k b -> g k c -> Collect (k, b, c)
data Query k v
[BaseD] :: (Iter f, Ord k) => BaseRep f k v -> f k v -> Query k v
[ProjectD] :: Ord k => Query k v -> Fun (k -> v -> u) -> Query k u
[AndD] :: Ord k => Query k v -> Query k w -> Query k (v, w)
[ChainD] :: (Ord k, Ord v) => Query k v -> Query v w -> Fun (k -> (v, w) -> u) -> Query k u
[AndPD] :: Ord k => Query k v -> Query k u -> Fun (k -> (v, u) -> w) -> Query k w
[OrD] :: Ord k => Query k v -> Query k v -> Fun (v -> v -> v) -> Query k v
[GuardD] :: Ord k => Query k v -> Fun (k -> v -> Bool) -> Query k v
[DiffD] :: Ord k => Query k v -> Query k u -> Query k v
smart :: Bool
projD :: Ord k => Query k v -> Fun (k -> v -> u) -> Query k u
andD :: Ord k => Query k v1 -> Query k v2 -> Query k (v1, v2)
andPD :: Ord k => Query k v1 -> Query k u -> Fun (k -> (v1, u) -> v) -> Query k v
chainD :: (Ord k, Ord v) => Query k v -> Query v w -> Fun (k -> (v, w) -> u) -> Query k u
guardD :: Ord k => Query k v -> Fun (k -> v -> Bool) -> Query k v

-- | Compile the (Exp (f k v)) to a Query iterator, and a BaseRep that
--   indicates how to materialize the iterator to the correct type. Recall
--   the iterator can be used to constuct many things using runCollect, but
--   here we want to materialize it to the same type as the (Exp (f k v)),
--   i.e. (f k v).
--   ================================================================================
compileSubterm :: Exp a -> Exp (f k v) -> Query k v
compile :: Exp (f k v) -> (Query k v, BaseRep f k v)
testing :: Bool
runSetExp :: Ord k => Exp (f k v) -> f k v
runSet :: Ord k => Exp (f k v) -> f k v
run :: Ord k => (Query k v, BaseRep f k v) -> f k v
runBoolExp :: Exp Bool -> Bool
runBool :: Exp Bool -> Bool
compute :: Exp t -> t
eval :: Embed s t => Exp t -> s
projStep :: Ord k => (t -> Collect (k, v, Query k v)) -> Fun (k -> v -> u) -> t -> Collect (k, u, Query k u)
andStep :: Ord a => (a, b1, Query a b1) -> (a, b2, Query a b2) -> Collect (a, (b1, b2), Query a (b1, b2))
chainStep :: (Ord b, Ord a) => (a, b, Query a b) -> Query b w -> Fun (a -> (b, w) -> u) -> Collect (a, u, Query a u)
andPstep :: Ord a => (a, b1, Query a b1) -> (a, b2, Query a b2) -> Fun (a -> (b1, b2) -> w) -> Collect (a, w, Query a w)
orStep :: (Ord k, Ord a) => (Query k v -> Collect (a, v, Query k v)) -> Query k v -> Query k v -> Fun (v -> v -> v) -> Collect (a, v, Query k v)
guardStep :: Ord a => (Query a b -> Collect (a, b, Query a b)) -> Fun (a -> b -> Bool) -> Query a b -> Collect (a, b, Query a b)
diffStep :: Ord k => (k, v, Query k v) -> Query k u -> Collect (k, v, Query k v)
rngStep :: Ord v => Query k v -> Sett v ()
nxtQuery :: Query a b -> Collect (a, b, Query a b)
lubQuery :: Ord a => a -> Query a b -> Collect (a, b, Query a b)
projectQ :: (Ord k, HasQuery c k v) => c -> Fun (k -> v -> u) -> Query k u
andQ :: (Ord k, HasQuery concrete1 k v, HasQuery concrete2 k w) => concrete1 -> concrete2 -> Query k (v, w)
orQ :: (Ord k, HasQuery concrete1 k v, HasQuery concrete2 k v) => concrete1 -> concrete2 -> Fun (v -> v -> v) -> Query k v
chainQ :: (Ord k, Ord v, HasQuery concrete1 k v, HasQuery concrete2 v w) => concrete1 -> concrete2 -> Fun (k -> (v, w) -> u) -> Query k u
andPQ :: (Ord k, HasQuery concrete1 k v, HasQuery concrete2 k u) => concrete1 -> concrete2 -> Fun (k -> (v, u) -> w) -> Query k w
guardQ :: (Ord k, HasQuery concrete k v) => concrete -> Fun (k -> v -> Bool) -> Query k v
class HasQuery concrete k v
query :: HasQuery concrete k v => concrete -> Query k v
ppQuery :: Query k v -> Doc
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Control.Iterate.SetAlgebra.Single k v)
instance GHC.Classes.Eq k => GHC.Classes.Eq (Control.Iterate.SetAlgebra.Sett k ())
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Control.Iterate.SetAlgebra.List k v)
instance Control.Iterate.SetAlgebra.HasQuery (Control.Iterate.SetAlgebra.Query k v) k v
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasQuery [(k, v)] k v
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasQuery (Data.Set.Internal.Set k) k ()
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasQuery (Data.Map.Internal.Map k v) k v
instance (GHC.Classes.Ord v, GHC.Classes.Ord k) => Control.Iterate.SetAlgebra.HasQuery (Control.Iterate.SetAlgebra.BiMap v k v) k v
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasQuery (Control.Iterate.SetAlgebra.Single k v) k v
instance Control.Iterate.SetAlgebra.Iter Control.Iterate.SetAlgebra.Query
instance GHC.Show.Show (Control.Iterate.SetAlgebra.Query k v)
instance GHC.Show.Show (Control.Iterate.SetAlgebra.Fun t)
instance GHC.Show.Show (Control.Iterate.SetAlgebra.Expr (a, b, c, d) t)
instance GHC.Show.Show (Control.Iterate.SetAlgebra.Lam t)
instance Control.Iterate.SetAlgebra.HasExp (Control.Iterate.SetAlgebra.Exp t) t
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasExp (Data.Map.Internal.Map k v) (Data.Map.Internal.Map k v)
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasExp (Data.Set.Internal.Set k) (Control.Iterate.SetAlgebra.Sett k ())
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasExp [(k, v)] (Control.Iterate.SetAlgebra.List k v)
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.HasExp (Control.Iterate.SetAlgebra.Single k v) (Control.Iterate.SetAlgebra.Single k v)
instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => Control.Iterate.SetAlgebra.HasExp (Control.Iterate.SetAlgebra.Bimap k v) (Control.Iterate.SetAlgebra.Bimap k v)
instance GHC.Show.Show (Control.Iterate.SetAlgebra.Exp t)
instance GHC.Show.Show (Control.Iterate.SetAlgebra.BaseRep f k v)
instance Control.Iterate.SetAlgebra.Basic Control.Iterate.SetAlgebra.List
instance GHC.Classes.Ord k => Control.Iterate.SetAlgebra.Embed [(k, v)] (Control.Iterate.SetAlgebra.List k v)
instance Control.Iterate.SetAlgebra.Iter Control.Iterate.SetAlgebra.List
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Control.Iterate.SetAlgebra.List k v)
instance Control.Iterate.SetAlgebra.Basic Control.Iterate.SetAlgebra.Single
instance Control.Iterate.SetAlgebra.Basic Data.Map.Internal.Map
instance GHC.Classes.Ord v => Control.Iterate.SetAlgebra.Basic (Control.Iterate.SetAlgebra.BiMap v)
instance Control.Iterate.SetAlgebra.Basic Control.Iterate.SetAlgebra.Sett
instance Control.Iterate.SetAlgebra.Iter Control.Iterate.SetAlgebra.Single
instance Control.Iterate.SetAlgebra.Iter Control.Iterate.SetAlgebra.Sett
instance Control.Iterate.SetAlgebra.Iter Data.Map.Internal.Map
instance GHC.Classes.Ord v => Control.Iterate.SetAlgebra.Iter (Control.Iterate.SetAlgebra.BiMap v)
instance Control.Iterate.SetAlgebra.Embed (Data.Set.Internal.Set k) (Control.Iterate.SetAlgebra.Sett k ())
instance Control.Iterate.SetAlgebra.Embed (Data.Map.Internal.Map k v) (Data.Map.Internal.Map k v)
instance Control.Iterate.SetAlgebra.Embed (Control.Iterate.SetAlgebra.BiMap v k v) (Control.Iterate.SetAlgebra.BiMap v k v)
instance Control.Iterate.SetAlgebra.Embed (Control.Iterate.SetAlgebra.Single k v) (Control.Iterate.SetAlgebra.Single k v)
instance Control.Iterate.SetAlgebra.Embed GHC.Types.Bool GHC.Types.Bool
instance GHC.Show.Show key => GHC.Show.Show (Control.Iterate.SetAlgebra.Sett key ())
instance (GHC.Classes.Ord a, GHC.Classes.Ord b, Cardano.Binary.ToCBOR.ToCBOR a, Cardano.Binary.ToCBOR.ToCBOR b) => Cardano.Binary.ToCBOR.ToCBOR (Control.Iterate.SetAlgebra.BiMap b a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b, Cardano.Binary.FromCBOR.FromCBOR a, Cardano.Binary.FromCBOR.FromCBOR b) => Cardano.Binary.FromCBOR.FromCBOR (Control.Iterate.SetAlgebra.BiMap b a b)
instance (NoThunks.Class.NoThunks a, NoThunks.Class.NoThunks b) => NoThunks.Class.NoThunks (Control.Iterate.SetAlgebra.BiMap v a b)
instance Control.DeepSeq.NFData (Control.Iterate.SetAlgebra.BiMap v a b)
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Control.Iterate.SetAlgebra.BiMap u k v)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Control.Iterate.SetAlgebra.BiMap u k v)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Control.Iterate.SetAlgebra.Single k v)

module Control.SetAlgebra
data List k v
data BiMap v a b
type Bimap k v = BiMap v k v
data Single k v
[Single] :: k -> v -> Single k v
[Fail] :: Single k v
[SetSingle] :: k -> Single k ()

-- | In order to build typed Exp (which are a typed deep embedding) of Set
--   operations, we need to know what kind of basic types of Maps and Sets
--   can be embedded. Every Basic type has a few operations for creating
--   one from a list, for adding and removing key-value pairs, looking up a
--   value given a key. Instances of this algebra are functional in that
--   every key has exactly one value associated with it.
--   ===================================================================================================
class Iter f => Basic f

-- | in addpair the new value always prevails, to make a choice use
--   <a>addkv</a> which has a combining function that allows choice.
addpair :: (Basic f, Ord k) => k -> v -> f k v -> f k v

-- | use ( old new -&gt; old) if you want the v in (f k v) to prevail, and
--   use ( old new -&gt; new) if you want the v in (k,v) to prevail
addkv :: (Basic f, Ord k) => (k, v) -> f k v -> (v -> v -> v) -> f k v
removekey :: (Basic f, Ord k) => k -> f k v -> f k v
domain :: (Basic f, Ord k) => f k v -> Set k
range :: (Basic f, Ord v) => f k v -> Set v
emptyc :: (Basic f, Ord k) => f k v
class Iter f
nxt :: Iter f => f a b -> Collect (a, b, f a b)
lub :: (Iter f, Ord k) => k -> f k b -> Collect (k, b, f k b)
hasNxt :: Iter f => f a b -> Maybe (a, b, f a b)
hasLub :: (Iter f, Ord k) => k -> f k b -> Maybe (k, b, f k b)
haskey :: (Iter f, Ord key) => key -> f key b -> Bool
isnull :: Iter f => f k v -> Bool
lookup :: (Iter f, Ord key) => key -> f key rng -> Maybe rng
element :: (Iter f, Ord k) => k -> f k v -> Collect ()
class Embed concrete base | concrete -> base
toBase :: Embed concrete base => concrete -> base
fromBase :: Embed concrete base => base -> concrete

-- | Basic types are those that can be embedded into Exp. The HasExp class,
--   encodes how to lift a Basic type into an Exp. The function
--   <a>toExp</a> will build a typed Exp for that Basic type. This will be
--   really usefull in the smart constructors.
--   ==================================================================
class HasExp s t | s -> t
toExp :: HasExp s t => s -> Exp t
data BaseRep f k v
[MapR] :: Basic Map => BaseRep Map k v
[SetR] :: Basic Sett => BaseRep Sett k ()
[ListR] :: Basic List => BaseRep List k v
[SingleR] :: Basic Single => BaseRep Single k v
[BiMapR] :: (Basic (BiMap v), Ord v) => BaseRep (BiMap v) k v
dom :: (Ord k, HasExp s (f k v)) => s -> Exp (Sett k ())
rng :: (Ord k, Ord v) => HasExp s (f k v) => s -> Exp (Sett v ())
dexclude :: (Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
drestrict :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
rexclude :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
rrestrict :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
unionleft :: (Show k, Show v, Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
unionright :: (Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
unionplus :: (Ord k, Monoid n, HasExp s1 (f k n), HasExp s2 (f k n)) => s1 -> s2 -> Exp (f k n)
singleton :: Ord k => k -> v -> Exp (Single k v)
setSingleton :: Ord k => k -> Exp (Single k ())
intersect :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (Sett k ())
subset :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
keyeq :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
(◁) :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(⋪) :: (Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(▷) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(⋫) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(∈) :: (Show k, Ord k, Iter g, HasExp s (g k ())) => k -> s -> Exp Bool
(∉) :: (Show k, Ord k, Iter g, HasExp s (g k ())) => k -> s -> Exp Bool
(∪) :: (Show k, Show v, Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
(⨃) :: (Ord k, HasExp s1 (f k v), HasExp s2 (g k v)) => s1 -> s2 -> Exp (f k v)
(∪+) :: (Ord k, Monoid n, HasExp s1 (f k n), HasExp s2 (f k n)) => s1 -> s2 -> Exp (f k n)
(∩) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (Sett k ())
(⊆) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
(≍) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp Bool
(<|) :: (Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) => s1 -> s2 -> Exp (f k v)
(|>) :: (Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) => s1 -> s2 -> Exp (f k v)
(➖) :: (Ord k, Iter f, Iter g, HasExp s1 (f k v), HasExp s2 (g k u)) => s1 -> s2 -> Exp (f k v)

-- | The self typed GADT: Exp, that encodes the shape of Set expressions. A
--   deep embedding. Exp is a typed Symbolic representation of queries we
--   may ask. It allows us to introspect a query The strategy is to 1)
--   Define Exp so all queries can be represented. 2) Define smart
--   constructors that "parse" the surface syntax, and build a typed Exp 3)
--   Write an evaluate function: eval:: Exp t -&gt; t 4) "eval" can
--   introspect the code and apply efficient domain and type specific
--   translations 5) Use the (Iter f) class to evaluate some Exp that can
--   benefit from its efficient nature.
--   ===============================================================================================
data Exp t
[Base] :: (Ord k, Basic f) => BaseRep f k v -> f k v -> Exp (f k v)
eval :: Embed s t => Exp t -> s

-- | Given a BaseRep we can materialize a (Collect k v) into the type
--   witnessed by the BaseRep. Recall a (Collect k v) has no intrinsic type
--   (it is just an ABSTRACT sequence of tuples), so the witness describes
--   how to turn them into the chosen datatype. Note that materialize is
--   meant to be applied to a collection built by iterating over a Query.
--   This produces the keys in ascending order, with no duplicate keys. So
--   we do not need to specify how to merge values.
--   =============================================================================================
materialize :: Ord k => BaseRep f k v -> Collect (k, v) -> f k v
biMapFromList :: (Ord k, Ord v) => (v -> v -> v) -> [(k, v)] -> BiMap v k v
biMapEmpty :: BiMap v k v
fromList :: Ord k => BaseRep f k v -> (v -> v -> v) -> [(k, v)] -> f k v
keysEqual :: Ord k => Map k v1 -> Map k v2 -> Bool
forwards :: BiMap v k v -> Map k v
backwards :: BiMap v k v -> Map v (Set k)


-- | MemoBytes is an abstration for a datetype that encodes its own
--   serialization. The idea is to use a newtype around a MemoBytes
--   non-memoizing version. For example: newtype Foo = Foo(MemoBytes
--   NonMemoizingFoo) This way all the instances for Foo
--   (Eq,Show,Ord,ToCBOR,FromCBOR,NoThunks,Generic) can be derived for
--   free.
module Data.MemoBytes
data MemoBytes t
Memo :: !t -> ShortByteString -> MemoBytes t
[memotype] :: MemoBytes t -> !t
[memobytes] :: MemoBytes t -> ShortByteString
memoBytes :: Encode w t -> MemoBytes t

-- | Useful when deriving FromCBOR(Annotator T) deriving via (Mem T)
--   instance (Era era) =&gt; FromCBOR (Annotator T)
type Mem t = Annotator (MemoBytes t)
shorten :: ByteString -> ShortByteString
showMemo :: Show t => MemoBytes t -> String
printMemo :: Show t => MemoBytes t -> IO ()
roundTripMemo :: FromCBOR t => MemoBytes t -> Either DeserialiseFailure (ByteString, MemoBytes t)
instance (Data.Typeable.Internal.Typeable t, NoThunks.Class.NoThunks t) => NoThunks.Class.NoThunks (Data.MemoBytes.MemoBytes t)
instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Data.MemoBytes.MemoBytes t)
instance GHC.Generics.Generic (Data.MemoBytes.MemoBytes t)
instance Data.Typeable.Internal.Typeable t => Cardano.Binary.ToCBOR.ToCBOR (Data.MemoBytes.MemoBytes t)
instance (Data.Typeable.Internal.Typeable t, Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator t)) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Data.MemoBytes.MemoBytes t))
instance GHC.Classes.Eq t => GHC.Classes.Eq (Data.MemoBytes.MemoBytes t)
instance GHC.Show.Show t => GHC.Show.Show (Data.MemoBytes.MemoBytes t)
instance GHC.Classes.Ord t => GHC.Classes.Ord (Data.MemoBytes.MemoBytes t)

module Data.Relation
class Relation m where {
    type family Domain m :: Type;
    type family Range m :: Type;
}
singleton :: Relation m => Domain m -> Range m -> m

-- | Domain
dom :: (Relation m, Ord (Domain m)) => m -> Set (Domain m)

-- | Range
range :: (Relation m, Ord (Range m)) => m -> Set (Range m)

-- | Domain restriction
--   
--   Unicode: 25c1
(◁) :: (Relation m, Ord (Domain m)) => Set (Domain m) -> m -> m

-- | Domain restriction
--   
--   Unicode: 25c1
(<|) :: (Relation m, Ord (Domain m)) => Set (Domain m) -> m -> m

-- | Domain exclusion
--   
--   Unicode: 22ea
(⋪) :: (Relation m, Ord (Domain m)) => Set (Domain m) -> m -> m

-- | Domain exclusion
--   
--   Unicode: 22ea
(</|) :: (Relation m, Ord (Domain m)) => Set (Domain m) -> m -> m

-- | Range restriction
--   
--   Unicode: 25b7
(▷) :: (Relation m, Ord (Range m)) => m -> Set (Range m) -> m

-- | Range restriction
--   
--   Unicode: 25b7
(|>) :: (Relation m, Ord (Range m)) => m -> Set (Range m) -> m

-- | Range exclusion
--   
--   Unicode: 22eb
(⋫) :: (Relation m, Ord (Range m)) => m -> Set (Range m) -> m

-- | Range exclusion
--   
--   Unicode: 22eb
(|/>) :: (Relation m, Ord (Range m)) => m -> Set (Range m) -> m

-- | Union
(∪) :: (Relation m, Ord (Domain m), Ord (Range m)) => m -> m -> m

-- | Union Override Right
(⨃) :: (Relation m, Ord (Domain m), Ord (Range m)) => m -> m -> m

-- | Size of the relation
size :: (Relation m, Integral n) => m -> n

-- | Is this key in the Domain, Instances should overide this default with
--   something more efficient
haskey :: (Relation m, Ord (Domain m)) => Domain m -> m -> Bool

-- | Insert (key,value) pair into the Relation. Instances should overide
--   this default with something more efficient
addpair :: (Relation m, Ord (Domain m), Ord (Range m)) => Domain m -> Range m -> m -> m

-- | Remove a key (and its associted value at that key) from the Relation.
--   Instances should overide this default with something more efficient
removekey :: (Relation m, Ord (Domain m)) => Domain m -> m -> m

-- | Inclusion among foldables.
--   
--   Unicode: 2286
(⊆) :: (Foldable f, Foldable g, Ord a) => f a -> g a -> Bool

-- | Union override plus is (AB)∪(BA)∪{k|-&gt;v1+v2 | k|-&gt;v1 : A /
--   k|-&gt;v2 : B} The library function Map.unionWith is more general, it
--   allows any type for <tt>b</tt> as long as (+) :: b -&gt; b -&gt; b
(∪+) :: (Ord a, Num b) => Map a b -> Map a b -> Map a b

-- | Alias for <a>elem</a>.
--   
--   Unicode: 2208
(∈) :: (Eq a, Foldable f) => a -> f a -> Bool

-- | Alias for not <a>elem</a>.
--   
--   Unicode: 2209
(∉) :: (Eq a, Foldable f) => a -> f a -> Bool
infixl 4 ∉
(∩) :: Ord a => Set a -> Set a -> Set a
instance Data.Relation.Relation (Data.Map.Internal.Map k v)
instance Data.Relation.Relation (Data.Set.Internal.Set (a, b))
instance Data.Relation.Relation [(a, b)]
