Îõ³h*2 .U       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ 0.1.0.0 Safe-InferredÀÁÜä crem5This is a newtype to be used with `deriving via`. If a has instances for   and ¡+, then `AllVertices a` has an instance of # which lists all the terms of type a.cremThe : class is implemented just as a list of elements of type a. Safe-InferredÀÜäj $cremÆA data type to represent a graph which is not tracking the vertex type&crem9A graph is just a list of edges between vertices of type a(cremõThe product graph. It has as vertices the product of the set of vertices of the initial graph. It has as edge from (a1, b1) to (a2, b2)' if and only if there is an edge from a1 to a2 and an edge from b1 to b26productGraph (Graph [('a', 'b')]) (Graph [('c', 'd')])Graph [(('a','c'),('b','d'))])cremŽComputes all the possible paths in the input graph and considers them as edges. Notice that the current implementation is removing duplicates*crem%Add all the identity edges to a graph+crem;Remove all the edges which start and end at the same vertex,cremSame as  productGraph but for  UntypedGraph-cremSame as transitiveClosureGraph but for  UntypedGraph.cremAdd all identity edges to an  UntypedGraph/cremÅRemove all the edges which start and end at the same vertex from an  UntypedGraph $%&'()*+,-./ &'()*+$%,-./ Safe-Inferred 1ÀÛÜä. cremA æ 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 ¢£crem Given a type aÈ for vertices, every transition from one vertex to any other is allowed3cremThe 3Á type class enables to automatically perform proof search for a 54 term. It has an instance for every constructor of 55cremAn value of type of (AllowedTransition topology initial final is a proof that the topology allows transitions from the initial to the final state6crem/We always allow an edge from a vertex to itself7cremIf a is the start and b% is the end of the first edge, then map contains an edge from a to b8crem%If we know that we have an edge from a to b0 in a topology, then we also have an edge from a to b if we add another edge out of a9crem%If we know that we have an edge from a to b in map", then we also have an edge from a to b if we add another vertexHcremÅ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<:;5678934IHKJ<:;5678934IHKJ Safe-Inferred1ÀÜä[Mcrem2The result of an action of the state machine. An 2ActionResult m topology state initialVertex output contains an output and a state finalVertex, where the transition from  initialVertex to  finalVertex is allowed by the machine topologyOcremA value of type InitialState stateÉ describes the initial state of a state machine, describing the initial vertex in the topology& and the actual initial data of type  state vertexQcremA Q2 is an effectful machine for every possible monad mò. Needing to work for every monad, in fact it can not perform any kind of effect and needs to be pure in nature.RcremA $BaseMachineT m topology input outputÌ describes a state machine with allowed transitions constrained by a given topology%. A state machine is composed by an T and an U, which defines the output and the new state given the current state and an input. The m+ parameter describes the context where the U of the machine is executedVcremAllows to change the context m0 where the machine operates to another context n, provided we have a  ,https://stackoverflow.com/a/58364172/2718064natural transformation from m to nWcrem1Allows to change the computational context of an M from m to n, given we have a  ,https://stackoverflow.com/a/58364172/2718064natural transformation from m to n.Xcrem Create an M+ without performing any side effect in the m contextYcremThis is fairly similar to ¤ from   Ä and in fact it does the same job, with the slight difference that ¤ would return =f (ActionResult Identity topology state initialVertex output)ZcremLift a  BaseMachineT to operate with ¥( inputs and outputs. If the input is a ¦, then the output will be a ¦. If the input is a §6, then the machine will be used to compute the output.[cremLift a  BaseMachineT to operate with ¨( inputs and outputs. If the input is a ©, then the output will be that ©. If the input is a ª6, then the machine will be used to compute the output.\crem\À transforms its input to its output and never changes its state]crem]ä transforms its input to its output and never changes its state, without performing any side effect^cremThe ^? machine simply outputs its input and never changes its state._cremÉa machine modelled with explicit state, where every transition is allowed`crem Given an inputÄ, run the machine to get an output and a new version of the machineMNOPQRTUSVWXYZ[\]^_`RTUSQVOPMNWXYZ[\]^_` Safe-Inferred)1ÀÛÜä!ÈecremA e2 is an effectful machine for every possible monad mò. Needing to work for every monad, in fact it can not perform any kind of effect and needs to be pure in nature.fcremA f is an effectful  +https://en.wikipedia.org/wiki/Mealy_machine Mealy machine with inputs of type input and outputs of type output%Effects are described by the context m0 in which the action of the machine is executedf is a tree, where leaves are R× and other nodes describe how to combine the subtrees to obtain more complex machines.Please refer to  Çhttps://github.com/tweag/crem/blob/main/docs/how-to-create-a-machine.md= for a more complete discussion on the various constructors.gcremg allows to interpret a R as a f, making the topology type variable existentialhcremh" adds categorical composition for ficremi- allows to process two machine simultaneouslyjcremj allows to process one out of two machines depending on the inputkcremkÕ allows to compose two machine going in oppositive directions and run them in a looplcremlÅ allows to compose sequentially machines which emit multiple outputsmcremAllows to change the context m0 where the machine operates to another context n, provided we have a  ,https://stackoverflow.com/a/58364172/2718064natural transformation from m to nncrem,a state machine which does not rely on stateocremÏa state machine which does not rely on state and does not perform side effectspcremÉa machine modelled with explicit state, where every transition is allowedqcrem Given an inputÄ, run the machine to get an output and a new version of the machinercremÇprocess multiple inputs in one go, accumulating the results in a monoiducremAn instance of «– allows us to have parallel composition of state machines, meaning that we can pass two inputs to two state machines and get out the outputs of bothefkihgljmnopqrfkihgljemnopqr Safe-Inferred")1ÀÜä'žycremA y is just a newtype around ¬ç to represents label which will be attached to every leaf of the tree defined by the constructors of f|crem| is just a newtype around Text& to specialize it to Mermaid diagramscremWe can render a & as a Mermaid state diagram€crem Prepends a y to the ­ output, as a ¬crem>Render all the vertices of a graph after labelling all of them‚crem!Render all vertices with no labelƒcrem;Render all the edges of a graph after labelling all of them„cremRender all edges with no label…cremJoin the outputs of  and ƒ to render an entire &†crem Render a & with no labels‡cremTurn a  into a &ˆcrem Interpret a Q as a &2 using the information contained in its topology.ÈThis is the point where we make usage of the machinery provided by the  .https://hackage.haskell.org/package/singletons singletonsÁ library, which require us to impose the constraints we have on vertex and topology‰crem Render an $ to the Mermaid formatŠcrem Render an $‹crem Interpret a e as an $Þ using the information contained in its structure and in the topology of its basic componentsŒcremÏNotice that we joining two non-empty mermaid diagrams, a newline will be addedy{z|~}€‚ƒ„…†‡ˆ‰Š‹|~}y{z€‚ƒ„…†‡ˆ‰Š‹ Safe-Inferred")ÀÜä*7’crem”A tree-like structure which could be used to attach metadata to any similar tree-like structure with only leaves and nodes with exactly two child.•cremGiven a f and a ’ of  MachineLabel7s, we can create a flow representation of our machine.‚For every leaf it will render the state space, while for every other node, it will render the flow between the composed machines.More details available in Çhttps://github.com/tweag/crem/tree/main/docs/how-to-render-a-machine.md /docs/how-to-render-a-machine.md’”“•’”“• Safe-Inferred1ÀÜä.-—cremæA smart wrapper over the machine state, which allows to enforce that only transitions allowed by the topology are actually performed.™cremA Decider topology input output- is a Decider which receives inputs of type input and emits outputs of type output=, where allowed transitions are constrained by the provided topology.;Being used to describe the domain logic of an aggregate, a ™ is always pure.It is defined by:its ›a œ) function, which says how to compute the output out of the input and the current statean Õ function, which allows us to specify the next state from the current state and the outputžcrem translate a ™ into a QŸcrem rebuild a ™ from a list of outputs$This is the main selling point of a ™ over a generic   9, since it allows rebuilding a machine from its outputs. —˜™œ›šžŸ ™œ›š—˜žŸ® !"#$%&'()*+,-./001123456789:;<=>?@ABCDDEFGHIJKLMNOPQRSTUVVWWXYYZ[\]^_`abcdefghij klmnopqrstuvwxyz{|}~~€€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™šš››œžŸ ¡¢£¡¢¤¥¦§¨¡©ª¡«¬¡«­¡«®¡¯°¡¯±¡¯²³´µ¶·¸¡¹º»crem-0.1.0.0-inplace Crem.TopologyCrem.Render.RenderableVertices Crem.GraphCrem.BaseMachineCrem.StateMachineCrem.Render.RenderCrem.Render.RenderFlow Crem.DecidercremData TraversableCrem StateMachineTopologyedgestrivialTopologyallowAllTopology AllVerticesRenderableVerticesvertices$fRenderableVertices(,,,,,,,)$fRenderableVertices(,,,,,,)$fRenderableVertices(,,,,,)$fRenderableVertices(,,,,)$fRenderableVertices(,,,)$fRenderableVertices(,,)$fRenderableVertices(,)$fRenderableVerticesEither$fRenderableVerticesProxy$fRenderableVerticesMaybe$fRenderableVerticesVoid$fRenderableVerticesAllVertices$fRenderableVerticesConst$fRenderableVerticesProduct$fRenderableVerticesDown$fRenderableVerticesSum$fRenderableVerticesDual$fRenderableVerticesIdentity$fRenderableVerticesLast$fRenderableVerticesFirst$fRenderableVerticesMax$fRenderableVerticesMin$fRenderableVerticesOrdering$fRenderableVerticesAny$fRenderableVerticesAll$fRenderableVerticesBool$fRenderableVertices() UntypedGraphGraph productGraphtransitiveClosureGraphaddIdentityEdgesremoveIdentityEdgesuntypedProductGraphuntypedTransitiveClosureGraphuntypedAddIdentityEdgesuntypedRemoveIdentityEdges$fShowUntypedGraph $fEqGraph $fShowGraphAllowedTransitionallowsTransitionAllowTransitionAllowIdentityEdgeAllowFirstEdgeAllowAddingEdgeAllowAddingVertex STopology TopologySym0'$fSuppressUnusedWarningsFUNTopologySym0$fSingIFUNEdgesSym0$$fSuppressUnusedWarningsFUNEdgesSym0$fSingIFUNTopologySym0$fSingI1ListTopologyTopology$fSingITopologyTopology$fSingKindTopology#$fAllowedTransitionvertextopologyaa#$fAllowedTransitionvertexTopologyab$$fAllowedTransitionvertexTopologyab0$$fAllowedTransitionvertexTopologyab1TrivialTopologysTrivialTopologyAllowAllTopologysAllowAllTopology9$fSuppressUnusedWarningsFUNLambda_6989586621679106594Sym0 ActionResult InitialState BaseMachine BaseMachineT initialStateaction baseHoist hoistResult pureResultsequencemaybeMeitherMstatelessBaseT statelessBaseidentityunrestrictedBaseMachineTrunBaseMachineT$fFunctorActionResult$fChoiceBaseMachineT$fStrongBaseMachineT$fProfunctorBaseMachineT StateMachineTBasic SequentialParallel AlternativeFeedbackKleislihoist statelessT statelessunrestrictedMachinerun runMultiple$fArrowChoiceStateMachineT$fArrowStateMachineT$fChoiceStateMachineT$fStrongStateMachineT$fProfunctorStateMachineT$fCategoryTYPEStateMachineT MachineLabelgetLabelMermaidgetTextrenderStateDiagram labelVertexrenderLabelledVerticesrenderVerticesrenderLabelledEdges renderEdgesrenderLabelledGraph renderGraphtopologyAsGraphbaseMachineAsGraphrenderUntypedStateDiagramrenderUntypedGraphmachineAsGraph$fSemigroupMermaid$fEqMachineLabel$fShowMachineLabel$fIsStringMachineLabel $fEqMermaid $fShowMermaid TreeMetadata LeafLabel BinaryLabel renderFlow$fShowTreeMetadataEvolutionResultDeciderdeciderInitialStatedecideevolvedeciderMachinerebuildDeciderbaseGHC.EnumEnumBoundedÒsingletons-th-3.2-bec01ef8ed99dbaa46a51431f37b9cba0c92ea9c433523e122ada8b19a410a07Data.Singletons.TH.Single singletonsLambda_6989586621679106594Data.Traversable sequenceA GHC.MaybeMaybeNothingJust Data.EitherEitherLeftRightÒprofunctors-5.6.2-d77a830527e9e636b8f429e4ffe30d513999f06fdbf1ac9bf5f2fd8edb1c7900Data.Profunctor.ChoiceChoice text-2.0.2Data.Text.InternalTextGHC.ShowShow