module Control.Remote.Monad.Packet.Weak where
import Control.Remote.Monad.Packet.Transport
data WeakPacket (c :: *) (p :: * -> *) (a :: *) where
Command :: c -> WeakPacket c p ()
Procedure :: p a -> WeakPacket c p a
deriving instance (Show c, Show (p a)) => Show (WeakPacket c p a)
instance (Read c, Read (Transport p)) => Read (Transport (WeakPacket c p)) where
readsPrec d = readParen (d > 10) $ \ r0 ->
[ (Transport $ Command c,r2)
| ("Command",r1) <- lex r0
, (c,r2) <- readsPrec 11 r1
] ++
[ (Transport $ Procedure p,r2)
| ("Procedure",r1) <- lex r0
, (Transport p,r2) <- readsPrec 11 r1
]