module Control.Remote.Monad.Packet.Strong where
import qualified Control.Remote.Monad.Packet.Weak as Weak
import Control.Remote.Monad.Packet.Weak (WeakPacket)
import Control.Natural
data StrongPacket (c :: *) (p :: * -> *) (a :: *) where
Command :: c -> StrongPacket c p b -> StrongPacket c p b
Procedure :: p a -> StrongPacket c p a
Done :: StrongPacket c p ()
runStrongPacket :: (Applicative m) => (WeakPacket c p ~> m) -> (StrongPacket c p ~> m)
runStrongPacket f (Command c pk) = f (Weak.Command c) *> runStrongPacket f pk
runStrongPacket f (Procedure p) = f (Weak.Procedure p)
runStrongPacket f Done = pure ()
newtype HStrongPacket c p = HStrongPacket (StrongPacket c p ~> StrongPacket c p)