| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Instance.Simulator
Description
Clocked state machines. Each step consumes one input and produces one output and the next machine. Composition and tensor advance every component once per clock cycle.
>>>runSimulator (stateless not) [False, True][True,False]>>>runSimulator (stateless (+ 1) . stateless (* 2)) [1 :: Int, 2][3,5]
Documentation
data SIMULATOR Source Github #
Instances
data Simulator (a :: SIMULATOR) (b :: SIMULATOR) where Source Github #
A machine and its current state, represented by its next step.
Constructors
| Simulator :: forall a1 b1. (a1 -> (b1, Simulator ('Sim a1) ('Sim b1))) -> Simulator ('Sim a1) ('Sim b1) |
Instances
| Promonad Simulator Source Github # | |
| MonoidalProfunctor Simulator Source Github # | |
Defined in Proarrow.Category.Instance.Simulator | |
| Profunctor Simulator Source Github # | |
Defined in Proarrow.Category.Instance.Simulator Methods dimap :: forall (c :: SIMULATOR) (a :: SIMULATOR) (b :: SIMULATOR) (d :: SIMULATOR). (c ~> a) -> (b ~> d) -> Simulator a b -> Simulator c d Source Github # lmap :: forall (c :: SIMULATOR) (a :: SIMULATOR) (b :: SIMULATOR). (c ~> a) -> Simulator a b -> Simulator c b Source Github # rmap :: forall (b :: SIMULATOR) (d :: SIMULATOR) (a :: SIMULATOR). (b ~> d) -> Simulator a b -> Simulator a d Source Github # (\\) :: forall (a :: SIMULATOR) (b :: SIMULATOR) r. ((Ob a, Ob b) => r) -> Simulator a b -> r Source Github # | |
stateless :: (a -> b) -> Simulator ('Sim a) ('Sim b) Source Github #
Apply a function independently in every clock cycle.