diff --git a/cabal.project b/cabal.project index 20a5a27..6e1a548 100644 --- a/cabal.project +++ b/cabal.project @@ -1,4 +1,4 @@ -index-state: 2025-05-05T00:00:00Z +index-state: 2025-05-21T15:48:46Z packages: ./typed-protocols ./typed-protocols-doc @@ -13,11 +13,3 @@ if impl(ghc >= 9.12) if os(windows) package text flags: -simdutf - -source-repository-package - type: git - location: https://github.com/input-output-hk/io-sim - tag: aef112549bf85d51a03919008b6091af8933e9e2 - --sha256: sha256-yfhBeAYwWktqBAkvXUVdrgBzNvTwAqMKglcjwflMtM4= - subdir: io-classes - io-sim diff --git a/typed-protocols/src/Network/TypedProtocol/Codec.hs b/typed-protocols/src/Network/TypedProtocol/Codec.hs index 8c259ee..7fdf440 100644 --- a/typed-protocols/src/Network/TypedProtocol/Codec.hs +++ b/typed-protocols/src/Network/TypedProtocol/Codec.hs @@ -322,8 +322,10 @@ data AnyMessage ps where -- requires @UndecidableInstances@ and @QuantifiedConstraints@. instance (forall (st :: ps) (st' :: ps). Show (Message ps st st')) => Show (AnyMessage ps) where - show (AnyMessage (msg :: Message ps st st')) = - "AnyMessage " ++ show msg + showsPrec d (AnyMessage (msg :: Message ps st st')) = + showParen (d > app_prec) (showString "AnyMessage " . showsPrec (app_prec + 1) msg) + where + app_prec = 10 -- | A convenient pattern synonym which unwrap 'AnyMessage' giving both the diff --git a/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs b/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs index 6826e29..3916c69 100644 --- a/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs +++ b/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs @@ -21,7 +21,6 @@ import Control.Monad.Class.MonadAsync import Control.Monad.Class.MonadST import Control.Monad.Class.MonadSTM import Control.Monad.Class.MonadThrow -import Control.Monad.Class.MonadTimer.SI import Control.Monad.IOSim import Control.Monad.ST (runST) import Control.Tracer (nullTracer) @@ -193,7 +192,7 @@ prop_channel_ST f xs = prop_channelPipelined :: ( MonadLabelledSTM m, MonadAsync m, MonadCatch m - , MonadDelay m, MonadST m) + , MonadST m) => (Int -> Int -> (Int, Int)) -> [Int] -> m Bool prop_channelPipelined f xs = do diff --git a/typed-protocols/typed-protocols.cabal b/typed-protocols/typed-protocols.cabal index 5232146..5951b40 100644 --- a/typed-protocols/typed-protocols.cabal +++ b/typed-protocols/typed-protocols.cabal @@ -3,6 +3,7 @@ name: typed-protocols version: 1.0.0.0 synopsis: A framework for strongly typed protocols description: A robust session type framework which supports protocol pipelining. + Haddocks are published [here](https://input-output-hk.github.io/typed-protocols/) license: Apache-2.0 license-files: LICENSE @@ -16,25 +17,12 @@ tested-with: GHC == {9.6, 9.8, 9.10, 9.12} extra-doc-files: CHANGELOG.md README.md -library - exposed-modules: Network.TypedProtocol - , Network.TypedProtocol.Core - , Network.TypedProtocol.Peer - , Network.TypedProtocol.Peer.Client - , Network.TypedProtocol.Peer.Server - , Network.TypedProtocol.Codec - , Network.TypedProtocol.Driver - , Network.TypedProtocol.Proofs - other-modules: Network.TypedProtocol.Lemmas - build-depends: base >=4.12 && <4.22, - io-classes:io-classes ^>= 1.8, - singletons ^>= 3.0 - - hs-source-dirs: src - default-language: GHC2021 - default-extensions: DataKinds - GADTs - LambdaCase +-- Minimal GHC setup, additional extensions are enabled per package (e.g. +-- pervasive type level extensions in the code base like `GADTs` or +-- `DataKinds`, etc), or per module (e.g. `CPP` or other more exotic ones). +common GHC + default-language: GHC2021 + default-extensions: LambdaCase ghc-options: -Wall -Wno-unticked-promoted-constructors -Wcompat @@ -43,33 +31,40 @@ library -Wpartial-fields -Widentities -Wredundant-constraints + -Wunused-packages -library cborg - visibility: public - exposed-modules: Network.TypedProtocol.Codec.CBOR - - build-depends: base, - bytestring >=0.10 && <0.13, - cborg >=0.2.1 && <0.3, - singletons, - primitive, +library + import: GHC + exposed-modules: Network.TypedProtocol + , Network.TypedProtocol.Core + , Network.TypedProtocol.Peer + , Network.TypedProtocol.Peer.Client + , Network.TypedProtocol.Peer.Server + , Network.TypedProtocol.Codec + , Network.TypedProtocol.Driver + , Network.TypedProtocol.Proofs + other-modules: Network.TypedProtocol.Lemmas + build-depends: base >=4.12 && <4.22, + io-classes:io-classes ^>= 1.8, + singletons ^>= 3.0 + hs-source-dirs: src + default-extensions: DataKinds + GADTs - io-classes:io-classes, - typed-protocols:typed-protocols +library cborg + import: GHC + visibility: public + exposed-modules: Network.TypedProtocol.Codec.CBOR + build-depends: base, + bytestring >=0.10 && <0.13, + cborg >=0.2.1 && <0.3, - hs-source-dirs: cborg - default-language: GHC2021 - default-extensions: LambdaCase - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints + io-classes:io-classes, + typed-protocols:typed-protocols + hs-source-dirs: cborg library stateful + import: GHC visibility: public exposed-modules: Network.TypedProtocol.Stateful.Peer , Network.TypedProtocol.Stateful.Peer.Client @@ -81,124 +76,88 @@ library stateful singletons, io-classes:io-classes, typed-protocols:typed-protocols - hs-source-dirs: stateful - default-language: GHC2021 default-extensions: DataKinds GADTs ImportQualifiedPost - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints library stateful-cborg - visibility: public - exposed-modules: Network.TypedProtocol.Stateful.Codec.CBOR - - build-depends: base, - bytestring, - cborg, - singletons, + import: GHC + visibility: public + exposed-modules: Network.TypedProtocol.Stateful.Codec.CBOR - io-classes:io-classes, - typed-protocols:{typed-protocols,cborg,stateful} + build-depends: base, + bytestring, + cborg, - hs-source-dirs: stateful-cborg - default-language: GHC2021 + io-classes:io-classes, + typed-protocols:{typed-protocols,cborg,stateful} + hs-source-dirs: stateful-cborg default-extensions: ImportQualifiedPost - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints library examples - visibility: public - exposed-modules: Network.TypedProtocol.Channel - , Network.TypedProtocol.Driver.Simple - - , Network.TypedProtocol.PingPong.Type - , Network.TypedProtocol.PingPong.Client - , Network.TypedProtocol.PingPong.Server - , Network.TypedProtocol.PingPong.Codec - , Network.TypedProtocol.PingPong.Codec.CBOR - , Network.TypedProtocol.PingPong.Examples - - , Network.TypedProtocol.ReqResp.Type - , Network.TypedProtocol.ReqResp.Client - , Network.TypedProtocol.ReqResp.Server - , Network.TypedProtocol.ReqResp.Codec - , Network.TypedProtocol.ReqResp.Codec.CBOR - , Network.TypedProtocol.ReqResp.Examples - - , Network.TypedProtocol.ReqResp2.Type - , Network.TypedProtocol.ReqResp2.Client - - , Network.TypedProtocol.Stateful.ReqResp.Type - , Network.TypedProtocol.Stateful.ReqResp.Client - , Network.TypedProtocol.Stateful.ReqResp.Server - , Network.TypedProtocol.Stateful.ReqResp.Codec - , Network.TypedProtocol.Stateful.ReqResp.Examples - - , Network.TypedProtocol.Trans.Wedge - build-depends: base, - bytestring, - cborg, - serialise, - singletons, - contra-tracer, - io-classes:{io-classes, si-timers}, - network, - time, - typed-protocols:{typed-protocols,cborg,stateful} - - hs-source-dirs: examples - default-language: GHC2021 + import: GHC + visibility: public + exposed-modules: Network.TypedProtocol.Channel + , Network.TypedProtocol.Driver.Simple + + , Network.TypedProtocol.PingPong.Type + , Network.TypedProtocol.PingPong.Client + , Network.TypedProtocol.PingPong.Server + , Network.TypedProtocol.PingPong.Codec + , Network.TypedProtocol.PingPong.Codec.CBOR + , Network.TypedProtocol.PingPong.Examples + + , Network.TypedProtocol.ReqResp.Type + , Network.TypedProtocol.ReqResp.Client + , Network.TypedProtocol.ReqResp.Server + , Network.TypedProtocol.ReqResp.Codec + , Network.TypedProtocol.ReqResp.Codec.CBOR + , Network.TypedProtocol.ReqResp.Examples + + , Network.TypedProtocol.ReqResp2.Type + , Network.TypedProtocol.ReqResp2.Client + + , Network.TypedProtocol.Stateful.ReqResp.Type + , Network.TypedProtocol.Stateful.ReqResp.Client + , Network.TypedProtocol.Stateful.ReqResp.Server + , Network.TypedProtocol.Stateful.ReqResp.Codec + , Network.TypedProtocol.Stateful.ReqResp.Examples + + , Network.TypedProtocol.Trans.Wedge + build-depends: base, + bytestring, + cborg, + serialise, + singletons, + contra-tracer, + io-classes:{io-classes, si-timers}, + typed-protocols:{typed-protocols,cborg,stateful} + if !os(windows) + build-depends: network + hs-source-dirs: examples default-extensions: DataKinds GADTs - LambdaCase - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints test-suite test - type: exitcode-stdio-1.0 - main-is: Main.hs - hs-source-dirs: test - default-language: GHC2021 + import: GHC + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: test default-extensions: GADTs - LambdaCase - other-modules: Network.TypedProtocol.PingPong.Tests - , Network.TypedProtocol.ReqResp.Tests - build-depends: base - , bytestring - , contra-tracer - , typed-protocols:{typed-protocols,cborg,examples} - , io-classes:{io-classes,si-timers} - , io-sim - , QuickCheck - , tasty - , tasty-quickcheck - + other-modules: Network.TypedProtocol.PingPong.Tests + , Network.TypedProtocol.ReqResp.Tests + build-depends: base + , bytestring + , contra-tracer + , typed-protocols:{typed-protocols,examples} + , io-classes:io-classes + , io-sim + , QuickCheck + , tasty + , tasty-quickcheck if !os(windows) build-depends: directory , network , unix - - ghc-options: -rtsopts - -Wall - -Wno-unticked-promoted-constructors - -Wno-orphans + ghc-options: -rtsopts