diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-11 20:22:33 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-21 20:15:21 +0100 |
commit | 83d291f476a9793012a7aabb27c3cf59c7bdea05 (patch) | |
tree | 42b60eac72c25df8280e412e706acbae80fa7a8b /src/Erebos/Conversation.hs | |
parent | f612d03ac7d5fb00fa76c3be14d965ab51988504 (diff) |
Generic type for MonadError constraints
Changelog: API: MonadError constraints use generic error type
Diffstat (limited to 'src/Erebos/Conversation.hs')
-rw-r--r-- | src/Erebos/Conversation.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Erebos/Conversation.hs b/src/Erebos/Conversation.hs index 7c9d329..dee6faa 100644 --- a/src/Erebos/Conversation.hs +++ b/src/Erebos/Conversation.hs @@ -101,10 +101,10 @@ conversationHistory (DirectMessageConversation thread) = map (\msg -> DirectMess conversationHistory (ChatroomConversation rstate) = map (\msg -> ChatroomMessage msg False) $ roomStateMessages rstate -sendMessage :: (MonadHead LocalState m, MonadError String m) => Conversation -> Text -> m (Maybe Message) +sendMessage :: (MonadHead LocalState m, MonadError e m, FromErebosError e) => Conversation -> Text -> m (Maybe Message) sendMessage (DirectMessageConversation thread) text = fmap Just $ DirectMessageMessage <$> (fromStored <$> sendDirectMessage (msgPeer thread) text) <*> pure False sendMessage (ChatroomConversation rstate) text = sendChatroomMessage rstate text >> return Nothing -deleteConversation :: (MonadHead LocalState m, MonadError String m) => Conversation -> m () -deleteConversation (DirectMessageConversation _) = throwError "deleting direct message conversation is not supported" +deleteConversation :: (MonadHead LocalState m, MonadError e m, FromErebosError e) => Conversation -> m () +deleteConversation (DirectMessageConversation _) = throwOtherError "deleting direct message conversation is not supported" deleteConversation (ChatroomConversation rstate) = deleteChatroomByStateData (head $ roomStateData rstate) |