Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A Topology
is a list of allowed transition for a state machine.
We are using it to enforce that only allowed transitions could be performed.
Synopsis
- newtype Topology vertex = Topology {
- edges :: [(vertex, [vertex])]
- data TopologySym0 :: (~>) [(vertex, [vertex])] (Topology vertex)
- data STopology :: forall vertex. Topology vertex -> Type where
- data AllowTransition (topology :: Topology vertex) (initial :: vertex) (final :: vertex) where
- AllowIdentityEdge :: AllowTransition topology a a
- AllowFirstEdge :: AllowTransition ('Topology ('(a, b ': l1) ': l2)) a b
- AllowAddingEdge :: AllowTransition ('Topology ('(a, l1) ': l2)) a b -> AllowTransition ('Topology ('(a, x ': l1) ': l2)) a b
- AllowAddingVertex :: AllowTransition ('Topology map) a b -> AllowTransition ('Topology (x ': map)) a b
- class AllowedTransition (topology :: Topology vertex) (initial :: vertex) (final :: vertex) where
- allowsTransition :: AllowTransition topology initial final
- trivialTopology :: Topology a
- sTrivialTopology :: Sing (TrivialTopologySym0 :: Topology a) :: Type
- type family TrivialTopology :: Topology a where ...
- allowAllTopology :: (Bounded a, Enum a) => Topology a
- sAllowAllTopology :: (SBounded a, SEnum a) => Sing (AllowAllTopologySym0 :: Topology a) :: Type
- type family AllowAllTopology :: Topology a where ...
Documentation
newtype Topology vertex Source #
A Topology
is a description of the topology of a state machine
It contains the collection of allowed transitions.
Since we are using this information at the type level, and then we want to
bring it down to the value level, we wrap it in singletons
Instances
SingKind vertex => SingKind (Topology vertex) Source # | |
SingI1 ('Topology :: [(vertex, [vertex])] -> Topology vertex) Source # | |
SingI n => SingI ('Topology n :: Topology vertex) Source # | |
Defined in Crem.Topology | |
SingI (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) Source # | |
Defined in Crem.Topology sing :: Sing TopologySym0 # | |
SuppressUnusedWarnings (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) Source # | |
Defined in Crem.Topology suppressUnusedWarnings :: () # | |
type Demote (Topology vertex) Source # | |
Defined in Crem.Topology | |
type Sing Source # | |
Defined in Crem.Topology | |
type Apply (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) (a6989586621679067816 :: [(vertex, [vertex])]) Source # | |
Defined in Crem.Topology |
data TopologySym0 :: (~>) [(vertex, [vertex])] (Topology vertex) Source #
Instances
SingI (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) Source # | |
Defined in Crem.Topology sing :: Sing TopologySym0 # | |
SuppressUnusedWarnings (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) Source # | |
Defined in Crem.Topology suppressUnusedWarnings :: () # | |
type Apply (TopologySym0 :: TyFun [(vertex, [vertex])] (Topology vertex) -> Type) (a6989586621679067816 :: [(vertex, [vertex])]) Source # | |
Defined in Crem.Topology |
data AllowTransition (topology :: Topology vertex) (initial :: vertex) (final :: vertex) where Source #
An value of type of AllowedTransition topology initial final
is a proof
that the topology
allows transitions from the initial
to the final
state
AllowIdentityEdge :: AllowTransition topology a a | We always allow an edge from a vertex to itself |
AllowFirstEdge :: AllowTransition ('Topology ('(a, b ': l1) ': l2)) a b | If |
AllowAddingEdge :: AllowTransition ('Topology ('(a, l1) ': l2)) a b -> AllowTransition ('Topology ('(a, x ': l1) ': l2)) a b | If we know that we have an edge from |
AllowAddingVertex :: AllowTransition ('Topology map) a b -> AllowTransition ('Topology (x ': map)) a b | If we know that we have an edge from |
class AllowedTransition (topology :: Topology vertex) (initial :: vertex) (final :: vertex) where Source #
The AllowedTransition
type class enables to automatically perform proof search
for a AllowTransition
term.
It has an instance for every constructor of AllowTransition
allowsTransition :: AllowTransition topology initial final Source #
Instances
AllowedTransition (topology :: Topology vertex) (a :: vertex) (a :: vertex) Source # | |
Defined in Crem.Topology allowsTransition :: AllowTransition topology a a Source # | |
AllowedTransition ('Topology ('(a, b ': l1) ': l2) :: Topology vertex) (a :: vertex) (b :: vertex) Source # | |
Defined in Crem.Topology allowsTransition :: AllowTransition ('Topology ('(a, b ': l1) ': l2)) a b Source # | |
AllowedTransition ('Topology ('(a, l1) ': l2)) a b => AllowedTransition ('Topology ('(a, x ': l1) ': l2) :: Topology vertex) (a :: vertex) (b :: vertex) Source # | |
Defined in Crem.Topology allowsTransition :: AllowTransition ('Topology ('(a, x ': l1) ': l2)) a b Source # | |
AllowedTransition ('Topology map) a b => AllowedTransition ('Topology (x ': map) :: Topology vertex) (a :: vertex) (b :: vertex) Source # | |
Defined in Crem.Topology allowsTransition :: AllowTransition ('Topology (x ': map)) a b Source # |
trivialTopology :: Topology a Source #
type family TrivialTopology :: Topology a where ... Source #
The trivial topology only allows identity transitions.
Given a type a
for vertices, only trivial transitions, i.e. staying
at the same vertex, are allowed
sAllowAllTopology :: (SBounded a, SEnum a) => Sing (AllowAllTopologySym0 :: Topology a) :: Type Source #
type family AllowAllTopology :: Topology a where ... Source #
AllowAllTopology = Apply TopologySym0 (Apply (Apply (>>=@#@$) (Apply (Apply EnumFromToSym0 MinBoundSym0) MaxBoundSym0)) Lambda_6989586621679106594Sym0) |