mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
all parties have resource state of the same kind
This commit is contained in:
@@ -11,20 +11,19 @@
|
||||
module Simplex.Messaging.Client where
|
||||
|
||||
import Control.Monad.Trans.Except
|
||||
import Control.Protocol (PartyCmd (..))
|
||||
import Polysemy.Internal
|
||||
import Simplex.Messaging.Protocol
|
||||
|
||||
instance Monad m => PartyProtocol m Recipient where
|
||||
api ::
|
||||
SimplexCommand from (Cmd Recipient s s') a ->
|
||||
SimplexCommand from '(Recipient, s, s') a ->
|
||||
Connection Recipient s ->
|
||||
ExceptT String m (a, Connection Recipient s')
|
||||
api (PushConfirm _ _) = apiStub
|
||||
api (PushMsg _ _) = apiStub
|
||||
|
||||
action ::
|
||||
SimplexCommand (Cmd Recipient s s') to a ->
|
||||
SimplexCommand '(Recipient, s, s') to a ->
|
||||
Connection Recipient s ->
|
||||
ExceptT String m a ->
|
||||
ExceptT String m (Connection Recipient s')
|
||||
@@ -37,13 +36,13 @@ instance Monad m => PartyProtocol m Recipient where
|
||||
|
||||
instance Monad m => PartyProtocol m Sender where
|
||||
api ::
|
||||
SimplexCommand from (Cmd Sender s s') a ->
|
||||
SimplexCommand from '(Sender, s, s') a ->
|
||||
Connection Sender s ->
|
||||
ExceptT String m (a, Connection Sender s')
|
||||
api (SendInvite _) = apiStub
|
||||
|
||||
action ::
|
||||
SimplexCommand (Cmd Sender s s') to a ->
|
||||
SimplexCommand '(Sender, s, s') to a ->
|
||||
Connection Sender s ->
|
||||
ExceptT String m a ->
|
||||
ExceptT String m (Connection Sender s')
|
||||
@@ -56,14 +55,14 @@ type SimplexSender = SimplexParty Sender
|
||||
|
||||
rApi ::
|
||||
Member SimplexRecipient r =>
|
||||
SimplexCommand from (Cmd Recipient s s') a ->
|
||||
SimplexCommand from '(Recipient, s, s') a ->
|
||||
Connection Recipient s ->
|
||||
Sem r (Either String (a, Connection Recipient s'))
|
||||
rApi cmd conn = send $ Api cmd conn
|
||||
|
||||
rAction ::
|
||||
Member SimplexRecipient r =>
|
||||
SimplexCommand (Cmd Recipient s s') to a ->
|
||||
SimplexCommand '(Recipient, s, s') to a ->
|
||||
Connection Recipient s ->
|
||||
Either String a ->
|
||||
Sem r (Either String (Connection Recipient s'))
|
||||
@@ -71,14 +70,14 @@ rAction cmd conn res = send $ Action cmd conn res
|
||||
|
||||
sApi ::
|
||||
Member SimplexSender r =>
|
||||
SimplexCommand from (Cmd Sender s s') a ->
|
||||
SimplexCommand from '(Sender, s, s') a ->
|
||||
Connection Sender s ->
|
||||
Sem r (Either String (a, Connection Sender s'))
|
||||
sApi cmd conn = send $ Api cmd conn
|
||||
|
||||
sAction ::
|
||||
Member SimplexSender r =>
|
||||
SimplexCommand (Cmd Sender s s') to a ->
|
||||
SimplexCommand '(Sender, s, s') to a ->
|
||||
Connection Sender s ->
|
||||
Either String a ->
|
||||
Sem r (Either String (Connection Sender s'))
|
||||
|
||||
Reference in New Issue
Block a user