Compare commits

...
3 Commits
Author SHA1 Message Date
Evgeny Poberezkin 091fbdd0e9 rename simplexmq-legacy into simplexmq-v0 (#270)
* rename simplexmq-legacy into simplexmq-v0

* split UnliftIO instance of ExceptT
2022-01-11 07:27:30 +00:00
Evgeny Poberezkin 8e4c9634e9 update to use legacy name 2022-01-08 10:13:21 +00:00
Evgeny Poberezkin e237c97d6e legacy package name: simplexmq-legacy 2022-01-08 10:03:27 +00:00
6 changed files with 39 additions and 31 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
name: simplexmq name: simplexmq-v0
version: 0.5.2 version: 0.5.3
synopsis: SimpleXMQ message broker synopsis: SimpleXMQ message broker
description: | description: |
This package includes <./docs/Simplex-Messaging-Server.html server>, This package includes <./docs/Simplex-Messaging-Server.html server>,
@@ -71,7 +71,7 @@ executables:
- cryptostore == 0.2.* - cryptostore == 0.2.*
- ini == 0.4.* - ini == 0.4.*
- optparse-applicative >= 0.15 && < 0.17 - optparse-applicative >= 0.15 && < 0.17
- simplexmq - simplexmq-v0
ghc-options: ghc-options:
- -threaded - -threaded
@@ -79,7 +79,7 @@ executables:
source-dirs: apps/smp-agent source-dirs: apps/smp-agent
main: Main.hs main: Main.hs
dependencies: dependencies:
- simplexmq - simplexmq-v0
ghc-options: ghc-options:
- -threaded - -threaded
@@ -88,7 +88,7 @@ tests:
source-dirs: tests source-dirs: tests
main: Test.hs main: Test.hs
dependencies: dependencies:
- simplexmq - simplexmq-v0
- hspec == 2.7.* - hspec == 2.7.*
- hspec-core == 2.7.* - hspec-core == 2.7.*
- HUnit == 1.6.* - HUnit == 1.6.*
+10 -11
View File
@@ -3,11 +3,9 @@ cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.4. -- This file has been generated from package.yaml by hpack version 0.34.4.
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
--
-- hash: f5e649e0c359792d9528dec6e6cf07af772a521d746e66b8cc2b86d8c604afb2
name: simplexmq name: simplexmq-v0
version: 0.5.2 version: 0.5.3
synopsis: SimpleXMQ message broker synopsis: SimpleXMQ message broker
description: This package includes <./docs/Simplex-Messaging-Server.html server>, description: This package includes <./docs/Simplex-Messaging-Server.html server>,
<./docs/Simplex-Messaging-Client.html client> and <./docs/Simplex-Messaging-Client.html client> and
@@ -39,6 +37,7 @@ library
Simplex.Messaging.Agent Simplex.Messaging.Agent
Simplex.Messaging.Agent.Client Simplex.Messaging.Agent.Client
Simplex.Messaging.Agent.Env.SQLite Simplex.Messaging.Agent.Env.SQLite
Simplex.Messaging.Agent.ExceptT
Simplex.Messaging.Agent.Protocol Simplex.Messaging.Agent.Protocol
Simplex.Messaging.Agent.RetryInterval Simplex.Messaging.Agent.RetryInterval
Simplex.Messaging.Agent.Store Simplex.Messaging.Agent.Store
@@ -59,7 +58,7 @@ library
Simplex.Messaging.Transport.WebSockets Simplex.Messaging.Transport.WebSockets
Simplex.Messaging.Util Simplex.Messaging.Util
other-modules: other-modules:
Paths_simplexmq Paths_simplexmq_v0
hs-source-dirs: hs-source-dirs:
src src
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns
@@ -105,7 +104,7 @@ library
executable smp-agent executable smp-agent
main-is: Main.hs main-is: Main.hs
other-modules: other-modules:
Paths_simplexmq Paths_simplexmq_v0
hs-source-dirs: hs-source-dirs:
apps/smp-agent apps/smp-agent
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded
@@ -136,7 +135,7 @@ executable smp-agent
, network-transport ==0.5.* , network-transport ==0.5.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
, simple-logger ==0.1.* , simple-logger ==0.1.*
, simplexmq , simplexmq-v0
, sqlite-simple ==0.4.* , sqlite-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell ==2.16.* , template-haskell ==2.16.*
@@ -152,7 +151,7 @@ executable smp-agent
executable smp-server executable smp-server
main-is: Main.hs main-is: Main.hs
other-modules: other-modules:
Paths_simplexmq Paths_simplexmq_v0
hs-source-dirs: hs-source-dirs:
apps/smp-server apps/smp-server
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded
@@ -186,7 +185,7 @@ executable smp-server
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, random >=1.1 && <1.3 , random >=1.1 && <1.3
, simple-logger ==0.1.* , simple-logger ==0.1.*
, simplexmq , simplexmq-v0
, sqlite-simple ==0.4.* , sqlite-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell ==2.16.* , template-haskell ==2.16.*
@@ -211,7 +210,7 @@ test-suite smp-server-test
ServerTests ServerTests
SMPAgentClient SMPAgentClient
SMPClient SMPClient
Paths_simplexmq Paths_simplexmq_v0
hs-source-dirs: hs-source-dirs:
tests tests
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns
@@ -245,7 +244,7 @@ test-suite smp-server-test
, network-transport ==0.5.* , network-transport ==0.5.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
, simple-logger ==0.1.* , simple-logger ==0.1.*
, simplexmq , simplexmq-v0
, sqlite-simple ==0.4.* , sqlite-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell ==2.16.* , template-haskell ==2.16.*
+1
View File
@@ -54,6 +54,7 @@ import qualified Data.Set as S
import Data.Text.Encoding import Data.Text.Encoding
import Data.Time.Clock import Data.Time.Clock
import Simplex.Messaging.Agent.Env.SQLite import Simplex.Messaging.Agent.Env.SQLite
import Simplex.Messaging.Agent.ExceptT ()
import Simplex.Messaging.Agent.Protocol import Simplex.Messaging.Agent.Protocol
import Simplex.Messaging.Agent.RetryInterval import Simplex.Messaging.Agent.RetryInterval
import Simplex.Messaging.Agent.Store import Simplex.Messaging.Agent.Store
+22
View File
@@ -0,0 +1,22 @@
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Simplex.Messaging.Agent.ExceptT where
import Control.Monad.Except
import Control.Monad.IO.Unlift
import UnliftIO.Exception (Exception)
import qualified UnliftIO.Exception as E
newtype InternalException e = InternalException {unInternalException :: e}
deriving (Eq, Show)
instance Exception e => Exception (InternalException e)
instance (MonadUnliftIO m, Exception e) => MonadUnliftIO (ExceptT e m) where
withRunInIO :: ((forall a. ExceptT e m a -> IO a) -> IO b) -> ExceptT e m b
withRunInIO exceptToIO =
withExceptT unInternalException . ExceptT . E.try $
withRunInIO $ \run ->
exceptToIO $ run . (either (E.throwIO . InternalException) return <=< runExceptT)
-15
View File
@@ -1,4 +1,3 @@
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -10,20 +9,6 @@ import Data.Bifunctor (first)
import Data.ByteString.Char8 (ByteString) import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Char8 as B
import UnliftIO.Async import UnliftIO.Async
import UnliftIO.Exception (Exception)
import qualified UnliftIO.Exception as E
newtype InternalException e = InternalException {unInternalException :: e}
deriving (Eq, Show)
instance Exception e => Exception (InternalException e)
instance (MonadUnliftIO m, Exception e) => MonadUnliftIO (ExceptT e m) where
withRunInIO :: ((forall a. ExceptT e m a -> IO a) -> IO b) -> ExceptT e m b
withRunInIO exceptToIO =
withExceptT unInternalException . ExceptT . E.try $
withRunInIO $ \run ->
exceptToIO $ run . (either (E.throwIO . InternalException) return <=< runExceptT)
raceAny_ :: MonadUnliftIO m => [m a] -> m () raceAny_ :: MonadUnliftIO m => [m a] -> m ()
raceAny_ = r [] raceAny_ = r []
+1
View File
@@ -22,6 +22,7 @@ import Data.Word (Word32)
import qualified Database.SQLite.Simple as DB import qualified Database.SQLite.Simple as DB
import Database.SQLite.Simple.QQ (sql) import Database.SQLite.Simple.QQ (sql)
import SMPClient (testKeyHash) import SMPClient (testKeyHash)
import Simplex.Messaging.Agent.ExceptT ()
import Simplex.Messaging.Agent.Protocol import Simplex.Messaging.Agent.Protocol
import Simplex.Messaging.Agent.Store import Simplex.Messaging.Agent.Store
import Simplex.Messaging.Agent.Store.SQLite import Simplex.Messaging.Agent.Store.SQLite