diff --git a/.github/workflows/github-page.yml b/.github/workflows/github-page.yml index bca81aff..3710f9ee 100644 --- a/.github/workflows/github-page.yml +++ b/.github/workflows/github-page.yml @@ -31,6 +31,9 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: + - name: Install pandoc + run: sudo apt install pandoc + - name: Checkout ouroboros-network repository uses: actions/checkout@v4 @@ -54,9 +57,12 @@ jobs: - name: Build plan run: cabal build --dry-run --enable-tests all + - name: Run pandoc + run: pandoc --from=gfm --to=haddock --output=README.haddock README.md + - name: Build Haddock documentation 🔧 run: | - cabal haddock-project --hackage all + cabal haddock-project --prologue=README.haddock --hackage all - name: Upload artifacts uses: actions/upload-pages-artifact@v3 diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index b3a0420b..6f4bca6d 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["8.10", "9.2", "9.4", "9.6", "9.8", "9.10"] + ghc: ["9.6", "9.8", "9.10", "9.12"] os: [ubuntu-latest, macos-latest, windows-latest] env: @@ -90,8 +90,8 @@ jobs: - name: Build projects [build] run: cabal build all - - name: typed-protocols-examples [test] - run: cabal run typed-protocols-examples:test + - name: typed-protocols:test + run: cabal run typed-protocols:test # - name: typed-protocols-doc [test] # run: cabal test typed-protocols-doc diff --git a/.gitignore b/.gitignore index c33954f5..c61ef96c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ dist-newstyle/ +README.haddock diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml index 036a8905..887cd8da 100644 --- a/.stylish-haskell.yaml +++ b/.stylish-haskell.yaml @@ -191,6 +191,25 @@ steps: # Default: false space_surround: false + # Post qualify option moves any qualifies found in import declarations + # to the end of the declaration. This also adjust padding for any + # unqualified import declarations. + # + # - true: Qualified as is moved to the end of the + # declaration. + # + # > import Data.Bar + # > import Data.Foo qualified as F + # + # - false: Qualified remains in the default location and unqualified + # imports are padded to align with qualified imports. + # + # > import Data.Bar + # > import qualified Data.Foo as F + # + # Default: false + post_qualify: true + # Language pragmas - language_pragmas: # We can generate different styles of language pragma lists. diff --git a/README.md b/README.md index dadebffb..c386483a 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,22 @@ typed-protocols A robust session type framework which supports [protocol pipelining][protocol-pipelining]. +Haddocks are published [here][haddocks]. + Public content -------------- -Duncan Coutts (@dcoutts) Haskell eXchange 2019 [talk][haskell-eXchange]. +[Duncan Coutts][dcoutts] Haskell eXchange 2019 [talk][haskell-eXchange]. -Monadic party workshop by Marcin Szamotulski (@coot): +Monadic party workshop by Marcin Szamotulski ([coot]): * [part 1][monadic-party-part-1] * [part 2][monadic-party-part-2] * [part 2][monadic-party-part-3] -Talk at [Haskell Love 2021][haskell-love] by Marcin Szamotulski (@coot), [slides][haskell-love-slides]. +Talk at [Haskell Love 2021][haskell-love] by Marcin Szamotulski ([coot]), [slides][haskell-love-slides]. -An [Agda][typed-protocols-agda] implementation by Marcin Szamotulski (@coot). +An [Agda][typed-protocols-agda] implementation by Marcin Szamotulski ([coot]). [protocol-pipelining]: https://www.wikiwand.com/en/Protocol_pipelining @@ -32,3 +34,6 @@ An [Agda][typed-protocols-agda] implementation by Marcin Szamotulski (@coot). [haskell-love-slides]: https://coot.me/posts/typed-protocols-at-haskell-love.html [haskell-love]: https://www.youtube.com/watch?v=EbK6VAqYh3g [typed-protocols-agda]: https://coot.me/agda/posts.agda.typed-protocols.html +[coot]: https://github.com/coot +[dcoutts]: https://github.com/dcoutts +[haddocks]: https://input-output-hk.github.io/typed-protocols diff --git a/cabal.project b/cabal.project index aa3a5229..20a5a27d 100644 --- a/cabal.project +++ b/cabal.project @@ -1,10 +1,6 @@ index-state: 2025-05-05T00:00:00Z packages: ./typed-protocols - ./typed-protocols-cborg - ./typed-protocols-stateful - ./typed-protocols-stateful-cborg - ./typed-protocols-examples ./typed-protocols-doc test-show-details: direct @@ -17,3 +13,11 @@ 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/scripts/check-stylish.sh b/scripts/check-stylish.sh index a90a801e..0eee1fab 100755 --- a/scripts/check-stylish.sh +++ b/scripts/check-stylish.sh @@ -5,6 +5,4 @@ export LC_ALL=C.UTF-8 [[ -x '/usr/bin/fd' ]] && FD="fd" || FD="fdfind" -$FD . './typed-protocols' -e hs -E Setup.hs -E Core.hs -X stylish-haskell -c .stylish-haskell.yaml -i -$FD . './typed-protocols-cborg' -e hs -E Setup.hs -X stylish-haskell -c .stylish-haskell.yaml -i -$FD . './typed-protocols-examples' -e hs -E Setup.hs -E Channel.hs -X stylish-haskell -c .stylish-haskell.yaml -i +$FD . './typed-protocols' -e hs -E Setup.hs -E Core.hs -E Channel.hs -X stylish-haskell -c .stylish-haskell.yaml -i diff --git a/typed-protocols-cborg/CHANGELOG.md b/typed-protocols-cborg/CHANGELOG.md deleted file mode 100644 index 2cfd50eb..00000000 --- a/typed-protocols-cborg/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Revision history for typed-protocols-cborg - -## 0.3.0.0 - -* bumped version to agree with `typed-protocols-stateful-0.3.0.0` - -## 0.2.0.0 - -* updated to use `typed-protocols-0.2.0.0` - -## 0.1.0.0 -- 2021-07-28 - -* Initial experiments and prototyping - diff --git a/typed-protocols-cborg/LICENSE b/typed-protocols-cborg/LICENSE deleted file mode 100644 index f433b1a5..00000000 --- a/typed-protocols-cborg/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/typed-protocols-cborg/NOTICE b/typed-protocols-cborg/NOTICE deleted file mode 100644 index 98b65037..00000000 --- a/typed-protocols-cborg/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright 2021-2025 Input Output Global Inc (IOG) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/typed-protocols-cborg/README.md b/typed-protocols-cborg/README.md deleted file mode 100644 index 0b3deea0..00000000 --- a/typed-protocols-cborg/README.md +++ /dev/null @@ -1,6 +0,0 @@ -typed-protocols-cborg -===================== - -[CBOR](https://hackage.haskell.org/package/cborg) codecs for -[typed-protocols](https://input-output-hk.github.io/typed-protocols) -package. diff --git a/typed-protocols-cborg/typed-protocols-cborg.cabal b/typed-protocols-cborg/typed-protocols-cborg.cabal deleted file mode 100644 index 64ea2698..00000000 --- a/typed-protocols-cborg/typed-protocols-cborg.cabal +++ /dev/null @@ -1,38 +0,0 @@ -cabal-version: 3.4 -name: typed-protocols-cborg -version: 0.4.0.0 -synopsis: CBOR codecs for typed-protocols --- description: -license: Apache-2.0 -license-files: - LICENSE - NOTICE -copyright: 2019-2025 Input Output Global Inc (IOG) -author: Alexander Vieth, Duncan Coutts, Marcin Szamotulski -maintainer: alex@well-typed.com, duncan@well-typed.com, marcin.szamotulski@iohk.io -category: Control -build-type: Simple -tested-with: GHC == {8.10, 9.2, 9.4, 9.6, 9.8, 9.10} -extra-doc-files: CHANGELOG.md, README.md - -library - exposed-modules: Network.TypedProtocol.Codec.CBOR - - build-depends: base >=4.12 && <4.22, - bytestring >=0.10 && <0.13, - cborg >=0.2.1 && <0.3, - singletons, - - io-classes:io-classes ^>=1.7, - typed-protocols ^>=0.4 - - hs-source-dirs: src - default-language: Haskell2010 - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/DefaultMain.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/DefaultMain.hs index a8dfe744..cf283767 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/DefaultMain.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/DefaultMain.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE FlexibleContexts #-} - module Network.TypedProtocol.Documentation.DefaultMain where diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/GraphViz.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/GraphViz.hs index 0f600523..4f144326 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/GraphViz.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/GraphViz.hs @@ -1,8 +1,3 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE PartialTypeSignatures #-} -{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} module Network.TypedProtocol.Documentation.GraphViz diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Html.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Html.hs index d21c2c24..c424a75f 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Html.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Html.hs @@ -1,12 +1,4 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE PartialTypeSignatures #-} -{-# LANGUAGE FlexibleContexts #-} module Network.TypedProtocol.Documentation.Html where diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/TH.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/TH.hs index 6c2acffa..0601fa7e 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/TH.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/TH.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE QuasiQuotes #-} module Network.TypedProtocol.Documentation.TH ( describeProtocol diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Text.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Text.hs index 4d0b4124..fabd04f2 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Text.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Text.hs @@ -1,9 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE PartialTypeSignatures #-} -{-# LANGUAGE FlexibleContexts #-} module Network.TypedProtocol.Documentation.Text where diff --git a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Types.hs b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Types.hs index 52d742bc..485bc2cf 100644 --- a/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Types.hs +++ b/typed-protocols-doc/src/Network/TypedProtocol/Documentation/Types.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveLift #-} -{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE OverloadedStrings #-} module Network.TypedProtocol.Documentation.Types diff --git a/typed-protocols-doc/typed-protocols-doc.cabal b/typed-protocols-doc/typed-protocols-doc.cabal index c157dcd5..373d50df 100644 --- a/typed-protocols-doc/typed-protocols-doc.cabal +++ b/typed-protocols-doc/typed-protocols-doc.cabal @@ -1,8 +1,9 @@ cabal-version: 3.0 name: typed-protocols-doc -version: 0.1.0.0 +version: 0.2.0.0 synopsis: Derive documentation from typed-protocols source code --- description: +description: Derive documentation for protocols implemented with + [typed-protocols](https://hackage.haskell.org/package/typed-protocols). license: Apache-2.0 license-file: LICENSE author: Tobias Dammers @@ -35,7 +36,6 @@ library -- other-modules: -- other-extensions: build-depends: base >=4.14.0.0 && <5 - , aeson >=2.0 && <2.3 , base64-bytestring >=1.2.1.0 && <1.3 , blaze-html >=0.9.1.2 && <0.10 @@ -54,14 +54,15 @@ library , th-abstraction >=0.6.0.0 && <0.8 , time >=1.12 && <1.14 , serdoc-core - , typed-protocols + , typed-protocols ^>= 1.0 hs-source-dirs: src - default-language: Haskell2010 + default-language: GHC2021 + default-extensions: DataKinds + LambdaCase executable typed-protocols-doc-demo import: warnings - default-language: Haskell2010 - type: exitcode-stdio-1.0 + default-language: GHC2021 hs-source-dirs: demo main-is: Main.hs other-modules: DemoProtocol @@ -76,7 +77,7 @@ executable typed-protocols-doc-demo test-suite typed-protocols-doc-test import: warnings - default-language: Haskell2010 + default-language: GHC2021 type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Main.hs diff --git a/typed-protocols-examples/LICENSE b/typed-protocols-examples/LICENSE deleted file mode 100644 index f433b1a5..00000000 --- a/typed-protocols-examples/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/typed-protocols-examples/NOTICE b/typed-protocols-examples/NOTICE deleted file mode 100644 index 3d6e49e7..00000000 --- a/typed-protocols-examples/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright 2019-2025 Input Output Global Inc (IOG) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/typed-protocols-examples/typed-protocols-examples.cabal b/typed-protocols-examples/typed-protocols-examples.cabal deleted file mode 100644 index cc6d8ba7..00000000 --- a/typed-protocols-examples/typed-protocols-examples.cabal +++ /dev/null @@ -1,109 +0,0 @@ -cabal-version: 3.4 -name: typed-protocols-examples -version: 0.6.0.0 -synopsis: Examples and tests for the typed-protocols framework --- description: -license: Apache-2.0 -license-files: - LICENSE - NOTICE -copyright: 2019-2025 Input Output Global Inc (IOG) -author: Alexander Vieth, Duncan Coutts, Marcin Szamotulski -maintainer: alex@well-typed.com, duncan@well-typed.com, marcin.szamotulski@iohk.io -category: Control -build-type: Simple -tested-with: GHC == {8.10, 9.2, 9.4, 9.6, 9.8, 9.10} - --- These should probably be added at some point. --- extra-doc-files: ChangeLog.md, README.md - -library - 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 - other-extensions: GADTs - , RankNTypes - , PolyKinds - , DataKinds - , ScopedTypeVariables - , TypeFamilies - , TypeOperators - , BangPatterns - build-depends: base, - bytestring, - cborg, - serialise, - singletons, - contra-tracer, - io-classes:{io-classes,si-timers}, - network, - time, - typed-protocols ^>= 0.4, - typed-protocols-cborg, - typed-protocols-stateful, - hs-source-dirs: src - default-language: Haskell2010 - -- ghc-9.2 pulls `ghc-heap-9.12` which is not compatible - if impl(ghc < 9.4) - build-depends: ghc-heap < 9.12 - 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 - other-modules: Network.TypedProtocol.PingPong.Tests - , Network.TypedProtocol.ReqResp.Tests - build-depends: base - , bytestring - , contra-tracer - , typed-protocols - , typed-protocols-cborg - , typed-protocols-examples - , io-classes:{io-classes,si-timers} - , io-sim - , QuickCheck - , tasty - , tasty-quickcheck - - if !os(windows) - build-depends: directory - , network - , unix - - default-language: Haskell2010 - ghc-options: -rtsopts - -Wall - -Wno-unticked-promoted-constructors - -Wno-orphans diff --git a/typed-protocols-stateful-cborg/CHANGELOG.md b/typed-protocols-stateful-cborg/CHANGELOG.md deleted file mode 100644 index 4ce3038d..00000000 --- a/typed-protocols-stateful-cborg/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# Revision history of typed-protocols-stateful - -## 0.3.0.0 - -* bumped version to agree with `typed-protocols-stateful-0.3.0.0`, in particular: - when encoding the local state associated to the initial message state is - passed to the codec. - -## 0.2.0.0 - -* Initial version - diff --git a/typed-protocols-stateful-cborg/LICENSE b/typed-protocols-stateful-cborg/LICENSE deleted file mode 100644 index f433b1a5..00000000 --- a/typed-protocols-stateful-cborg/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/typed-protocols-stateful-cborg/NOTICE b/typed-protocols-stateful-cborg/NOTICE deleted file mode 100644 index 5f99bd13..00000000 --- a/typed-protocols-stateful-cborg/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright 2022-2025 Input Output Global Inc (IOG) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/typed-protocols-stateful-cborg/README.md b/typed-protocols-stateful-cborg/README.md deleted file mode 100644 index cb4ebb84..00000000 --- a/typed-protocols-stateful-cborg/README.md +++ /dev/null @@ -1,6 +0,0 @@ -typed-protocols-stateful-cborg -============================== - -[CBOR](https://hackage.haskell.org/package/cborg) codecs for -[typed-protocols-stateful](https://input-output-hk.github.io/typed-protocols/typed-protocols-stateful) -package. diff --git a/typed-protocols-stateful-cborg/typed-protocols-stateful-cborg.cabal b/typed-protocols-stateful-cborg/typed-protocols-stateful-cborg.cabal deleted file mode 100644 index c134068a..00000000 --- a/typed-protocols-stateful-cborg/typed-protocols-stateful-cborg.cabal +++ /dev/null @@ -1,43 +0,0 @@ -cabal-version: 3.4 -name: typed-protocols-stateful-cborg -version: 0.4.0.0 -synopsis: CBOR codecs for typed-protocols --- description: -license: Apache-2.0 -license-files: - LICENSE - NOTICE -copyright: 2022-2025 Input Output Global Inc (IOG) -author: Marcin Szamotulski -maintainer: marcin.szamotulski@iohk.io -category: Control -tested-with: GHC == {8.10, 9.2, 9.4, 9.6, 9.8, 9.10} -build-type: Simple - --- These should probably be added at some point. -extra-doc-files: CHANGELOG.md, README.md - -library - exposed-modules: Network.TypedProtocol.Stateful.Codec.CBOR - - build-depends: base >=4.12 && <4.22, - bytestring >=0.10 && <0.13, - cborg >=0.2.1 && <0.3, - singletons, - - io-classes, - typed-protocols ^>= 0.4, - typed-protocols-cborg, - typed-protocols-stateful - - hs-source-dirs: src - default-language: Haskell2010 - default-extensions: ImportQualifiedPost - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints diff --git a/typed-protocols-stateful/CHANGELOG.md b/typed-protocols-stateful/CHANGELOG.md deleted file mode 100644 index 68e4c840..00000000 --- a/typed-protocols-stateful/CHANGELOG.md +++ /dev/null @@ -1,20 +0,0 @@ -# Revision history of typed-protocols-stateful - -## 0.3.0.0 - -* when encoding a message the local state associated to the initial message - state, rather than final state, is passed to the codec. For that reason: - * `Yield` requires local state associated to both the initial and final protocol state - * `Codec` and `Driver` have changed accordingly - - This change eliminates the need to have add extra fields in messages which - are not send over the wire, see the `Network.TypedProtocol.Stateful.ReqResp` - example. -* `AnyMessage` takes only the local state associated to the initial protocol state of the `Message`. -* Removed `Show` instance of `AnyMessage`, provided instead `showAnyMessage`. -* `AnyMessageWithAgency` pattern synonym is exported as a constructor of `AnyMessage`. -* constraints of `prop_*` APIs where changed. - -## 0.2.0.0 - -* Initial version diff --git a/typed-protocols-stateful/LICENSE b/typed-protocols-stateful/LICENSE deleted file mode 100644 index f433b1a5..00000000 --- a/typed-protocols-stateful/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/typed-protocols-stateful/NOTICE b/typed-protocols-stateful/NOTICE deleted file mode 100644 index 5f99bd13..00000000 --- a/typed-protocols-stateful/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright 2022-2025 Input Output Global Inc (IOG) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/typed-protocols-stateful/README.md b/typed-protocols-stateful/README.md deleted file mode 100644 index 4a9b66e8..00000000 --- a/typed-protocols-stateful/README.md +++ /dev/null @@ -1,6 +0,0 @@ -typed-protocols-stateful -======================== - -A stateful `typed-protocols` version which allows to track state changes along -side protocol transtions. It allows to build codes depends on the current -state. diff --git a/typed-protocols-stateful/typed-protocols-stateful.cabal b/typed-protocols-stateful/typed-protocols-stateful.cabal deleted file mode 100644 index bc0f891f..00000000 --- a/typed-protocols-stateful/typed-protocols-stateful.cabal +++ /dev/null @@ -1,50 +0,0 @@ -cabal-version: 3.4 -name: typed-protocols-stateful -version: 0.4.0.0 -synopsis: A framework for strongly typed protocols --- description: -license: Apache-2.0 -license-files: - LICENSE - NOTICE -copyright: 2022-2025 Input Output Global Inc (IOG) -author: Marcin Szamotulski -maintainer: marcin.szamotulski@iohk.io -category: Control -build-type: Simple -tested-with: GHC == {8.10, 9.2, 9.4, 9.6, 9.8, 9.10} -extra-doc-files: CHANGELOG.md - -library - exposed-modules: Network.TypedProtocol.Stateful.Peer - , Network.TypedProtocol.Stateful.Peer.Client - , Network.TypedProtocol.Stateful.Peer.Server - , Network.TypedProtocol.Stateful.Driver - , Network.TypedProtocol.Stateful.Proofs - , Network.TypedProtocol.Stateful.Codec - - other-extensions: GADTs - , RankNTypes - , PolyKinds - , DataKinds - , ScopedTypeVariables - , TypeFamilies - , TypeOperators - , BangPatterns - default-extensions: ImportQualifiedPost - build-depends: base, - contra-tracer, - singletons >= 3.0, - io-classes, - typed-protocols ^>= 0.4 - - hs-source-dirs: src - default-language: Haskell2010 - ghc-options: -Wall - -Wno-unticked-promoted-constructors - -Wcompat - -Wincomplete-uni-patterns - -Wincomplete-record-updates - -Wpartial-fields - -Widentities - -Wredundant-constraints diff --git a/typed-protocols/README.md b/typed-protocols/README.md new file mode 120000 index 00000000..32d46ee8 --- /dev/null +++ b/typed-protocols/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/typed-protocols-cborg/src/Network/TypedProtocol/Codec/CBOR.hs b/typed-protocols/cborg/Network/TypedProtocol/Codec/CBOR.hs similarity index 86% rename from typed-protocols-cborg/src/Network/TypedProtocol/Codec/CBOR.hs rename to typed-protocols/cborg/Network/TypedProtocol/Codec/CBOR.hs index 990960e2..a0ff3a21 100644 --- a/typed-protocols-cborg/src/Network/TypedProtocol/Codec/CBOR.hs +++ b/typed-protocols/cborg/Network/TypedProtocol/Codec/CBOR.hs @@ -1,11 +1,3 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE MonoLocalBinds #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.Codec.CBOR ( module Network.TypedProtocol.Codec , mkCodecCborLazyBS @@ -16,21 +8,21 @@ module Network.TypedProtocol.Codec.CBOR , CBOR.DeserialiseFailure (..) ) where -import Control.Monad.Class.MonadST (MonadST (..)) -import Control.Monad.ST hiding (stToIO) - -import qualified Codec.CBOR.Decoding as CBOR (Decoder) -import qualified Codec.CBOR.Encoding as CBOR (Encoding) -import qualified Codec.CBOR.Read as CBOR -import qualified Codec.CBOR.Write as CBOR -import qualified Data.ByteString as BS -import qualified Data.ByteString.Builder as BS -import qualified Data.ByteString.Builder.Extra as BS -import qualified Data.ByteString.Lazy as LBS -import qualified Data.ByteString.Lazy.Internal as LBS (smallChunkSize) - -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Core +import Control.Monad.Class.MonadST (MonadST (..)) +import Control.Monad.ST hiding (stToIO) + +import Codec.CBOR.Decoding qualified as CBOR (Decoder) +import Codec.CBOR.Encoding qualified as CBOR (Encoding) +import Codec.CBOR.Read qualified as CBOR +import Codec.CBOR.Write qualified as CBOR +import Data.ByteString qualified as BS +import Data.ByteString.Builder qualified as BS +import Data.ByteString.Builder.Extra qualified as BS +import Data.ByteString.Lazy qualified as LBS +import Data.ByteString.Lazy.Internal qualified as LBS (smallChunkSize) + +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Core -- | Construct a 'Codec' for a CBOR based serialisation format, using strict diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Channel.hs b/typed-protocols/examples/Network/TypedProtocol/Channel.hs similarity index 92% rename from typed-protocols-examples/src/Network/TypedProtocol/Channel.hs rename to typed-protocols/examples/Network/TypedProtocol/Channel.hs index 3333928a..a53670e7 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Channel.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Channel.hs @@ -1,9 +1,4 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE CPP #-} module Network.TypedProtocol.Channel ( Channel (..) @@ -24,22 +19,22 @@ module Network.TypedProtocol.Channel , loggingChannel ) where -import Control.Concurrent.Class.MonadSTM -import Control.Monad ((>=>)) -import Control.Monad.Class.MonadSay -import Control.Monad.Class.MonadTimer.SI -import qualified Data.ByteString as BS -import qualified Data.ByteString.Lazy as LBS -import Data.ByteString.Lazy.Internal (smallChunkSize) -import Data.Proxy -import Numeric.Natural +import Control.Concurrent.Class.MonadSTM +import Control.Monad ((>=>)) +import Control.Monad.Class.MonadSay +import Control.Monad.Class.MonadTimer.SI +import Data.ByteString qualified as BS +import Data.ByteString.Lazy qualified as LBS +import Data.ByteString.Lazy.Internal (smallChunkSize) +import Data.Proxy +import Numeric.Natural #if !defined(mingw32_HOST_OS) -import Network.Socket (Socket) -import qualified Network.Socket.ByteString.Lazy as Socket +import Network.Socket (Socket) +import Network.Socket.ByteString.Lazy qualified as Socket #endif -import qualified System.IO as IO (Handle, hFlush, hIsEOF) +import System.IO qualified as IO (Handle, hFlush, hIsEOF) -- | One end of a duplex channel. It is a reliable, ordered channel of some diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Driver/Simple.hs b/typed-protocols/examples/Network/TypedProtocol/Driver/Simple.hs similarity index 92% rename from typed-protocols-examples/src/Network/TypedProtocol/Driver/Simple.hs rename to typed-protocols/examples/Network/TypedProtocol/Driver/Simple.hs index 04a4dcfe..93e18233 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Driver/Simple.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Driver/Simple.hs @@ -1,11 +1,3 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -- @UndecidableInstances@ extensions is required for defining @Show@ instance -- of @'TraceSendRecv'@. @@ -32,15 +24,15 @@ module Network.TypedProtocol.Driver.Simple , runDecoderWithChannel ) where -import Network.TypedProtocol.Channel -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Core -import Network.TypedProtocol.Driver -import Network.TypedProtocol.Peer +import Network.TypedProtocol.Channel +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Core +import Network.TypedProtocol.Driver +import Network.TypedProtocol.Peer -import Control.Monad.Class.MonadAsync -import Control.Monad.Class.MonadThrow -import Control.Tracer (Tracer (..), contramap, traceWith) +import Control.Monad.Class.MonadAsync +import Control.Monad.Class.MonadThrow +import Control.Tracer (Tracer (..), contramap, traceWith) -- $intro diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Client.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Client.hs similarity index 94% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Client.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Client.hs index b6398428..2a68b47d 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Client.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Client.hs @@ -1,9 +1,3 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeOperators #-} - module Network.TypedProtocol.PingPong.Client ( -- * Normal client PingPongClient (..) @@ -14,9 +8,9 @@ module Network.TypedProtocol.PingPong.Client , pingPongClientPeerPipelined ) where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer.Client -import Network.TypedProtocol.PingPong.Type +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer.Client +import Network.TypedProtocol.PingPong.Type -- | A ping-pong client, on top of some effect 'm'. -- diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Codec.hs similarity index 89% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Codec.hs index f825dae7..405addca 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Codec.hs @@ -1,15 +1,8 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.PingPong.Codec where -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Core -import Network.TypedProtocol.PingPong.Type +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Core +import Network.TypedProtocol.PingPong.Type codecPingPong diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec/CBOR.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Codec/CBOR.hs similarity index 60% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec/CBOR.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Codec/CBOR.hs index 0d674a3b..6dd0499b 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Codec/CBOR.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Codec/CBOR.hs @@ -1,24 +1,17 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.PingPong.Codec.CBOR where -import Control.Monad.Class.MonadST +import Control.Monad.Class.MonadST -import Data.ByteString.Lazy (ByteString) +import Data.ByteString.Lazy (ByteString) -import qualified Codec.CBOR.Decoding as CBOR (Decoder, decodeWord) -import qualified Codec.CBOR.Encoding as CBOR (Encoding, encodeWord) -import qualified Codec.CBOR.Read as CBOR +import Codec.CBOR.Decoding qualified as CBOR (Decoder, decodeWord) +import Codec.CBOR.Encoding qualified as CBOR (Encoding, encodeWord) +import Codec.CBOR.Read qualified as CBOR -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Codec.CBOR -import Network.TypedProtocol.Core -import Network.TypedProtocol.PingPong.Type +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Codec.CBOR +import Network.TypedProtocol.Core +import Network.TypedProtocol.PingPong.Type codecPingPong :: forall m. diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Examples.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Examples.hs similarity index 92% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Examples.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Examples.hs index efcc6ea8..2aa2bf12 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Examples.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Examples.hs @@ -1,16 +1,9 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeOperators #-} - module Network.TypedProtocol.PingPong.Examples where -import Network.TypedProtocol.PingPong.Client -import Network.TypedProtocol.PingPong.Server +import Network.TypedProtocol.PingPong.Client +import Network.TypedProtocol.PingPong.Server -import Network.TypedProtocol.Peer.Client +import Network.TypedProtocol.Peer.Client -- | The standard stateless ping-pong server instance. diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Server.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Server.hs similarity index 86% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Server.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Server.hs index 768b9621..58696293 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Server.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Server.hs @@ -1,12 +1,10 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} {-# LANGUAGE RecordWildCards #-} module Network.TypedProtocol.PingPong.Server where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer.Server -import Network.TypedProtocol.PingPong.Type +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer.Server +import Network.TypedProtocol.PingPong.Type data PingPongServer m a = PingPongServer { diff --git a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Type.hs b/typed-protocols/examples/Network/TypedProtocol/PingPong/Type.hs similarity index 89% rename from typed-protocols-examples/src/Network/TypedProtocol/PingPong/Type.hs rename to typed-protocols/examples/Network/TypedProtocol/PingPong/Type.hs index 5c8c5534..a606dcb0 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/PingPong/Type.hs +++ b/typed-protocols/examples/Network/TypedProtocol/PingPong/Type.hs @@ -1,14 +1,8 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeFamilies #-} module Network.TypedProtocol.PingPong.Type where -import Network.TypedProtocol.Core +import Network.TypedProtocol.Core -- | The ping\/pong protocol and the states in its protocol state machine. diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Client.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Client.hs similarity index 91% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Client.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Client.hs index 4bb1e6a4..81d93075 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Client.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Client.hs @@ -1,9 +1,3 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.ReqResp.Client ( -- * Normal client ReqRespClient (..) @@ -17,11 +11,11 @@ module Network.TypedProtocol.ReqResp.Client , requestOnce ) where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer.Client -import Network.TypedProtocol.Peer.Server (Server) -import Network.TypedProtocol.Proofs (connect) -import Network.TypedProtocol.ReqResp.Type +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer.Client +import Network.TypedProtocol.Peer.Server (Server) +import Network.TypedProtocol.Proofs (connect) +import Network.TypedProtocol.ReqResp.Type data ReqRespClient req resp m a where SendMsgReq :: req diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec.hs similarity index 85% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec.hs index 9152de55..ae614278 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec.hs @@ -1,18 +1,10 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.ReqResp.Codec where -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Core -import Network.TypedProtocol.PingPong.Codec (decodeTerminatedFrame) -import Network.TypedProtocol.ReqResp.Type -import Text.Read (readMaybe) +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Core +import Network.TypedProtocol.PingPong.Codec (decodeTerminatedFrame) +import Network.TypedProtocol.ReqResp.Type +import Text.Read (readMaybe) codecReqResp :: diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec/CBOR.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec/CBOR.hs similarity index 60% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec/CBOR.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec/CBOR.hs index 0f12bb3b..18935eee 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Codec/CBOR.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec/CBOR.hs @@ -1,28 +1,21 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.ReqResp.Codec.CBOR where -import Control.Monad.Class.MonadST +import Control.Monad.Class.MonadST -import Data.ByteString.Lazy (ByteString) +import Data.ByteString.Lazy (ByteString) -import qualified Codec.CBOR.Decoding as CBOR (Decoder, decodeListLen, - decodeWord) -import qualified Codec.CBOR.Encoding as CBOR (Encoding, encodeListLen, - encodeWord) -import qualified Codec.CBOR.Read as CBOR -import Codec.Serialise.Class (Serialise) -import qualified Codec.Serialise.Class as CBOR +import Codec.CBOR.Decoding qualified as CBOR (Decoder, decodeListLen, + decodeWord) +import Codec.CBOR.Encoding qualified as CBOR (Encoding, encodeListLen, + encodeWord) +import Codec.CBOR.Read qualified as CBOR +import Codec.Serialise.Class (Serialise) +import Codec.Serialise.Class qualified as CBOR -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Codec.CBOR -import Network.TypedProtocol.Core -import Network.TypedProtocol.ReqResp.Type +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Codec.CBOR +import Network.TypedProtocol.Core +import Network.TypedProtocol.ReqResp.Type codecReqResp :: forall req resp m. diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Examples.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Examples.hs similarity index 89% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Examples.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Examples.hs index ecfb1932..2b7706ac 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Examples.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Examples.hs @@ -1,15 +1,9 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.ReqResp.Examples where -import Network.TypedProtocol.ReqResp.Client -import Network.TypedProtocol.ReqResp.Server +import Network.TypedProtocol.ReqResp.Client +import Network.TypedProtocol.ReqResp.Server -import Network.TypedProtocol.Peer.Client +import Network.TypedProtocol.Peer.Client -- | An example request\/response client which ignores received responses. -- diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Server.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Server.hs similarity index 90% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Server.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Server.hs index dcb91806..1d8127c1 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Server.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Server.hs @@ -4,9 +4,9 @@ module Network.TypedProtocol.ReqResp.Server where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer.Server -import Network.TypedProtocol.ReqResp.Type +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer.Server +import Network.TypedProtocol.ReqResp.Type data ReqRespServer req resp m a = ReqRespServer { diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Type.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Type.hs similarity index 79% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Type.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp/Type.hs index bd41a9f5..69df3221 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp/Type.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp/Type.hs @@ -1,15 +1,8 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeFamilies #-} module Network.TypedProtocol.ReqResp.Type where -import Network.TypedProtocol.Core +import Network.TypedProtocol.Core data ReqResp req resp where diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Client.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp2/Client.hs similarity index 79% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Client.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp2/Client.hs index aa2fd081..ff6beb8a 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Client.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp2/Client.hs @@ -1,18 +1,9 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} - - - module Network.TypedProtocol.ReqResp2.Client where -import Network.TypedProtocol.ReqResp2.Type +import Network.TypedProtocol.ReqResp2.Type -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer.Client +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer.Client reqResp2Client :: forall req resp m. diff --git a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Type.hs b/typed-protocols/examples/Network/TypedProtocol/ReqResp2/Type.hs similarity index 83% rename from typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Type.hs rename to typed-protocols/examples/Network/TypedProtocol/ReqResp2/Type.hs index 14a567b0..706b05ef 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/ReqResp2/Type.hs +++ b/typed-protocols/examples/Network/TypedProtocol/ReqResp2/Type.hs @@ -1,15 +1,8 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeFamilies #-} module Network.TypedProtocol.ReqResp2.Type where -import Network.TypedProtocol.Core +import Network.TypedProtocol.Core data ReqResp2 req resp where diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Client.hs b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Client.hs similarity index 67% rename from typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Client.hs rename to typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Client.hs index e72a724b..e5160947 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Client.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Client.hs @@ -1,18 +1,11 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.Stateful.ReqResp.Client ( ReqRespClient (..) , reqRespClientPeer ) where -import Data.Typeable -import Network.TypedProtocol.Stateful.Peer.Client -import Network.TypedProtocol.Stateful.ReqResp.Type +import Data.Typeable +import Network.TypedProtocol.Stateful.Peer.Client +import Network.TypedProtocol.Stateful.ReqResp.Type data ReqRespClient req m a where SendMsgReq :: Typeable resp diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Codec.hs b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Codec.hs similarity index 84% rename from typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Codec.hs rename to typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Codec.hs index 538ffd82..fb1ff8fb 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Codec.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Codec.hs @@ -1,21 +1,12 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeOperators #-} - module Network.TypedProtocol.Stateful.ReqResp.Codec where -import Data.Kind (Type) -import Data.Singletons.Decide -import Data.Typeable -import Network.TypedProtocol.Core -import Network.TypedProtocol.PingPong.Codec (decodeTerminatedFrame) -import Network.TypedProtocol.Stateful.Codec -import Network.TypedProtocol.Stateful.ReqResp.Type +import Data.Kind (Type) +import Data.Singletons.Decide +import Data.Typeable +import Network.TypedProtocol.Core +import Network.TypedProtocol.PingPong.Codec (decodeTerminatedFrame) +import Network.TypedProtocol.Stateful.Codec +import Network.TypedProtocol.Stateful.ReqResp.Type data Some (f :: k -> Type) where Some :: Typeable a => f a -> Some f diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Examples.hs b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Examples.hs similarity index 66% rename from typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Examples.hs rename to typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Examples.hs index 7827e5a8..817c712e 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Examples.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Examples.hs @@ -1,14 +1,7 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.Stateful.ReqResp.Examples where -import Network.TypedProtocol.Stateful.ReqResp.Server -import Network.TypedProtocol.Stateful.ReqResp.Type +import Network.TypedProtocol.Stateful.ReqResp.Server +import Network.TypedProtocol.Stateful.ReqResp.Type fileRPCServer :: Monad m diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Server.hs b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Server.hs similarity index 65% rename from typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Server.hs rename to typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Server.hs index 680ad2ea..91a12fa2 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Server.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Server.hs @@ -1,19 +1,11 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.Stateful.ReqResp.Server ( ReqRespServer (..) , reqRespServerPeer ) where -import Data.Typeable -import Network.TypedProtocol.Stateful.Peer.Server -import Network.TypedProtocol.Stateful.ReqResp.Type +import Data.Typeable +import Network.TypedProtocol.Stateful.Peer.Server +import Network.TypedProtocol.Stateful.ReqResp.Type data ReqRespServer req m a = ReqRespServer { diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Type.hs b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Type.hs similarity index 85% rename from typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Type.hs rename to typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Type.hs index 31e06339..cb22bfad 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Stateful/ReqResp/Type.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Stateful/ReqResp/Type.hs @@ -1,12 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeFamilies #-} -- | An RPC protocol which in which request type determines respond time. -- Unlike in the `Network.TypedProtocol.ReqResp.Type` where `req` and `resp` @@ -15,9 +7,9 @@ -- module Network.TypedProtocol.Stateful.ReqResp.Type where -import Data.Kind (Type) -import Data.Typeable -import Network.TypedProtocol.Core +import Data.Kind (Type) +import Data.Typeable +import Network.TypedProtocol.Core type ReqResp :: (Type -> Type) -> Type diff --git a/typed-protocols-examples/src/Network/TypedProtocol/Trans/Wedge.hs b/typed-protocols/examples/Network/TypedProtocol/Trans/Wedge.hs similarity index 86% rename from typed-protocols-examples/src/Network/TypedProtocol/Trans/Wedge.hs rename to typed-protocols/examples/Network/TypedProtocol/Trans/Wedge.hs index 05a628ad..648964dc 100644 --- a/typed-protocols-examples/src/Network/TypedProtocol/Trans/Wedge.hs +++ b/typed-protocols/examples/Network/TypedProtocol/Trans/Wedge.hs @@ -1,24 +1,12 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE InstanceSigs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} module Network.TypedProtocol.Trans.Wedge where -import Network.TypedProtocol.Core +import Network.TypedProtocol.Core -import qualified Network.TypedProtocol.Peer.Client as Client -import qualified Network.TypedProtocol.PingPong.Type as PingPong +import Network.TypedProtocol.Peer.Client qualified as Client +import Network.TypedProtocol.PingPong.Type qualified as PingPong -- | A [wedge](https://hackage.haskell.org/package/smash-0.1.2/docs/Data-Wedge.html) diff --git a/typed-protocols/src/Network/TypedProtocol.hs b/typed-protocols/src/Network/TypedProtocol.hs index b79a0aec..5f0d716d 100644 --- a/typed-protocols/src/Network/TypedProtocol.hs +++ b/typed-protocols/src/Network/TypedProtocol.hs @@ -16,9 +16,9 @@ module Network.TypedProtocol , module Network.TypedProtocol.Driver ) where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Driver -import Network.TypedProtocol.Proofs +import Network.TypedProtocol.Core +import Network.TypedProtocol.Driver +import Network.TypedProtocol.Proofs -- $intro diff --git a/typed-protocols/src/Network/TypedProtocol/Codec.hs b/typed-protocols/src/Network/TypedProtocol/Codec.hs index 5b16e98f..8c259ee5 100644 --- a/typed-protocols/src/Network/TypedProtocol/Codec.hs +++ b/typed-protocols/src/Network/TypedProtocol/Codec.hs @@ -1,14 +1,5 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} {-# LANGUAGE QuantifiedConstraints #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeFamilies #-} -- @UndecidableInstances@ extension is required for defining @Show@ instance of -- @'AnyMessage'@ and @'AnyMessage'@. {-# LANGUAGE UndecidableInstances #-} @@ -57,12 +48,12 @@ module Network.TypedProtocol.Codec , SomeState (..) ) where -import Control.Exception (Exception) -import Data.Kind (Type) -import Data.Monoid (All (..)) +import Control.Exception (Exception) +import Data.Kind (Type) +import Data.Monoid (All (..)) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Driver (SomeMessage (..)) +import Network.TypedProtocol.Core +import Network.TypedProtocol.Driver (SomeMessage (..)) -- | A codec for a 'Protocol' handles the encoding and decoding of typed diff --git a/typed-protocols/src/Network/TypedProtocol/Core.hs b/typed-protocols/src/Network/TypedProtocol/Core.hs index e8314979..3fdbb9b3 100644 --- a/typed-protocols/src/Network/TypedProtocol/Core.hs +++ b/typed-protocols/src/Network/TypedProtocol/Core.hs @@ -1,20 +1,7 @@ -{-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DerivingVia #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeFamilyDependencies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE ViewPatterns #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ViewPatterns #-} {-# OPTIONS_HADDOCK show-extensions #-} @@ -64,10 +51,10 @@ module Network.TypedProtocol.Core , unsafeIntToNat ) where -import Data.Kind (Constraint, Type) -import Unsafe.Coerce (unsafeCoerce) +import Data.Kind (Constraint, Type) +import Unsafe.Coerce (unsafeCoerce) -import Data.Singletons +import Data.Singletons -- $intro -- A typed protocol between two peers is defined via a state machine: a diff --git a/typed-protocols/src/Network/TypedProtocol/Driver.hs b/typed-protocols/src/Network/TypedProtocol/Driver.hs index b12d66c9..607d641d 100644 --- a/typed-protocols/src/Network/TypedProtocol/Driver.hs +++ b/typed-protocols/src/Network/TypedProtocol/Driver.hs @@ -1,13 +1,4 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeFamilies #-} -- | Actions for running 'Peer's with a 'Driver' -- @@ -23,15 +14,15 @@ module Network.TypedProtocol.Driver , runPipelinedPeerWithDriver ) where -import Data.Void (Void) +import Data.Void (Void) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer -import Control.Concurrent.Class.MonadSTM.TQueue -import Control.Monad.Class.MonadAsync -import Control.Monad.Class.MonadFork -import Control.Monad.Class.MonadSTM +import Control.Concurrent.Class.MonadSTM.TQueue +import Control.Monad.Class.MonadAsync +import Control.Monad.Class.MonadFork +import Control.Monad.Class.MonadSTM -- $intro diff --git a/typed-protocols/src/Network/TypedProtocol/Lemmas.hs b/typed-protocols/src/Network/TypedProtocol/Lemmas.hs index 20bc5f0a..3e55771f 100644 --- a/typed-protocols/src/Network/TypedProtocol/Lemmas.hs +++ b/typed-protocols/src/Network/TypedProtocol/Lemmas.hs @@ -1,9 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# HLINT ignore "Use camelCase" #-} @@ -16,8 +11,8 @@ -- module Network.TypedProtocol.Lemmas where -import Data.Kind (Type) -import Network.TypedProtocol.Core +import Data.Kind (Type) +import Network.TypedProtocol.Core -- $about diff --git a/typed-protocols/src/Network/TypedProtocol/Peer.hs b/typed-protocols/src/Network/TypedProtocol/Peer.hs index d95e55a1..d2ceec2c 100644 --- a/typed-protocols/src/Network/TypedProtocol/Peer.hs +++ b/typed-protocols/src/Network/TypedProtocol/Peer.hs @@ -1,13 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE DerivingVia #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE DerivingVia #-} -- | Protocol EDSL. -- @@ -22,9 +13,9 @@ module Network.TypedProtocol.Peer , unsafeIntToNat ) where -import Data.Kind (Type) +import Data.Kind (Type) -import Network.TypedProtocol.Core as Core +import Network.TypedProtocol.Core as Core -- | A description of a peer that engages in a protocol. -- diff --git a/typed-protocols/src/Network/TypedProtocol/Peer/Client.hs b/typed-protocols/src/Network/TypedProtocol/Peer/Client.hs index 60c355c4..c77c15d4 100644 --- a/typed-protocols/src/Network/TypedProtocol/Peer/Client.hs +++ b/typed-protocols/src/Network/TypedProtocol/Peer/Client.hs @@ -1,11 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE PatternSynonyms #-} -- | Bidirectional patterns for @'Peer' ps 'AsClient'@. The advantage of -- these patterns is that they automatically provide the 'ReflRelativeAgency' @@ -35,11 +28,11 @@ module Network.TypedProtocol.Peer.Client , Nat (..) ) where -import Data.Kind (Type) +import Data.Kind (Type) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer (Peer) -import qualified Network.TypedProtocol.Peer as TP +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer (Peer) +import Network.TypedProtocol.Peer qualified as TP type Client :: forall ps diff --git a/typed-protocols/src/Network/TypedProtocol/Peer/Server.hs b/typed-protocols/src/Network/TypedProtocol/Peer/Server.hs index 025fbf3f..67c45623 100644 --- a/typed-protocols/src/Network/TypedProtocol/Peer/Server.hs +++ b/typed-protocols/src/Network/TypedProtocol/Peer/Server.hs @@ -1,11 +1,5 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE TypeOperators #-} -- | Bidirectional patterns for @'Peer' ps 'AsServer'@. The advantage of -- these patterns is that they automatically provide the 'ReflRelativeAgency' @@ -35,11 +29,11 @@ module Network.TypedProtocol.Peer.Server , Nat (..) ) where -import Data.Kind (Type) +import Data.Kind (Type) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Peer (Peer) -import qualified Network.TypedProtocol.Peer as TP +import Network.TypedProtocol.Core +import Network.TypedProtocol.Peer (Peer) +import Network.TypedProtocol.Peer qualified as TP type Server :: forall ps diff --git a/typed-protocols/src/Network/TypedProtocol/Proofs.hs b/typed-protocols/src/Network/TypedProtocol/Proofs.hs index 69125573..4f70c86a 100644 --- a/typed-protocols/src/Network/TypedProtocol/Proofs.hs +++ b/typed-protocols/src/Network/TypedProtocol/Proofs.hs @@ -1,13 +1,5 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} {-# LANGUAGE QuantifiedConstraints #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -- This is already implied by the -Wall in the .cabal file, but lets just be -- completely explicit about it too, since we rely on the completeness @@ -32,10 +24,10 @@ module Network.TypedProtocol.Proofs , pipelineInterleaving ) where -import Data.Singletons -import Network.TypedProtocol.Core -import Network.TypedProtocol.Lemmas -import Network.TypedProtocol.Peer +import Data.Singletons +import Network.TypedProtocol.Core +import Network.TypedProtocol.Lemmas +import Network.TypedProtocol.Peer -- | The 'connect' function takes two peers that agree on a protocol and runs diff --git a/typed-protocols-stateful-cborg/src/Network/TypedProtocol/Stateful/Codec/CBOR.hs b/typed-protocols/stateful-cborg/Network/TypedProtocol/Stateful/Codec/CBOR.hs similarity index 93% rename from typed-protocols-stateful-cborg/src/Network/TypedProtocol/Stateful/Codec/CBOR.hs rename to typed-protocols/stateful-cborg/Network/TypedProtocol/Stateful/Codec/CBOR.hs index 552dc597..015f8ae6 100644 --- a/typed-protocols-stateful-cborg/src/Network/TypedProtocol/Stateful/Codec/CBOR.hs +++ b/typed-protocols/stateful-cborg/Network/TypedProtocol/Stateful/Codec/CBOR.hs @@ -1,10 +1,3 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE MonoLocalBinds #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} - module Network.TypedProtocol.Stateful.Codec.CBOR ( module Network.TypedProtocol.Stateful.Codec , DeserialiseFailure @@ -24,10 +17,10 @@ import Data.ByteString.Builder.Extra qualified as BS import Data.ByteString.Lazy qualified as LBS import Data.ByteString.Lazy.Internal qualified as LBS (smallChunkSize) -import Network.TypedProtocol.Stateful.Codec import Network.TypedProtocol.Codec.CBOR (DeserialiseFailure, - convertCborDecoderBS, convertCborDecoderLBS) + convertCborDecoderBS, convertCborDecoderLBS) import Network.TypedProtocol.Core +import Network.TypedProtocol.Stateful.Codec -- | Construct a 'Codec' for a CBOR based serialisation format, using strict diff --git a/typed-protocols-stateful/src/Network/TypedProtocol.hs b/typed-protocols/stateful/Network/TypedProtocol.hs similarity index 97% rename from typed-protocols-stateful/src/Network/TypedProtocol.hs rename to typed-protocols/stateful/Network/TypedProtocol.hs index b79a0aec..5f0d716d 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol.hs +++ b/typed-protocols/stateful/Network/TypedProtocol.hs @@ -16,9 +16,9 @@ module Network.TypedProtocol , module Network.TypedProtocol.Driver ) where -import Network.TypedProtocol.Core -import Network.TypedProtocol.Driver -import Network.TypedProtocol.Proofs +import Network.TypedProtocol.Core +import Network.TypedProtocol.Driver +import Network.TypedProtocol.Proofs -- $intro diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Codec.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Codec.hs similarity index 90% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Codec.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Codec.hs index 33451ac4..84f5c238 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Codec.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Codec.hs @@ -1,18 +1,10 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE QuantifiedConstraints #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ViewPatterns #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ViewPatterns #-} -- @UndecidableInstances@ extension is required for defining @Show@ instance of -- @'AnyMessage'@ and @'AnyMessage'@. -{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-dodgy-imports #-} -- | Stateful codec. This module is intended to be imported qualified. @@ -31,7 +23,7 @@ module Network.TypedProtocol.Stateful.Codec -- ** Related types -- *** SomeMessage , SomeMessage (..) - -- *** StateToken + -- *** StateToken , StateToken , StateTokenI (..) -- *** ActiveState @@ -51,15 +43,14 @@ module Network.TypedProtocol.Stateful.Codec , prop_codecs_compat ) where -import Data.Kind (Type) -import Data.Monoid (All (..)) +import Data.Kind (Type) +import Data.Monoid (All (..)) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Codec (CodecFailure (..), - DecodeStep (..), SomeMessage (..), hoistDecodeStep, - isoDecodeStep, mapFailureDecodeStep, runDecoder, - runDecoderPure) -import qualified Network.TypedProtocol.Codec as TP hiding (AnyMessageAndAgency) +import Network.TypedProtocol.Codec (CodecFailure (..), DecodeStep (..), + SomeMessage (..), hoistDecodeStep, isoDecodeStep, + mapFailureDecodeStep, runDecoder, runDecoderPure) +import Network.TypedProtocol.Codec qualified as TP hiding (AnyMessageAndAgency) +import Network.TypedProtocol.Core -- | A stateful codec. diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Driver.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Driver.hs similarity index 90% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Driver.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Driver.hs index 90bdb64a..0209df08 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Driver.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Driver.hs @@ -1,14 +1,3 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} - -- | Actions for running 'Peer's with a 'Driver'. This module should be -- imported qualified. -- diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer.hs similarity index 91% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer.hs index f821d69b..bbe6518b 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer.hs @@ -1,25 +1,12 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} -- TODO: the 'Functor' instance of 'Peer' is undecidable -{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE UndecidableInstances #-} -- | Protocol stateful EDSL. -- -- __Note__: 'Network.TypedProtocol.Peer.Client.Client' and -- 'Network.TypedProtocol.Peer.Server.Server' patterns are easier to use. -- -module Network.TypedProtocol.Stateful.Peer - ( Peer (..) - ) where +module Network.TypedProtocol.Stateful.Peer (Peer (..)) where import Data.Kind (Type) diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Client.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Client.hs similarity index 80% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Client.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Client.hs index 65eed230..fc027040 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Client.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Client.hs @@ -1,11 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE PatternSynonyms #-} -- | Bidirectional patterns for @'Peer' ps 'AsClient'@. The advantage of -- these patterns is that they automatically provide the 'RelativeAgencyEq' @@ -20,11 +13,11 @@ module Network.TypedProtocol.Stateful.Peer.Client , pattern Done ) where -import Data.Kind (Type) +import Data.Kind (Type) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Stateful.Peer (Peer) -import qualified Network.TypedProtocol.Stateful.Peer as TP +import Network.TypedProtocol.Core +import Network.TypedProtocol.Stateful.Peer (Peer) +import Network.TypedProtocol.Stateful.Peer qualified as TP type Client :: forall ps diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Server.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Server.hs similarity index 80% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Server.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Server.hs index 6c865539..803810a6 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Peer/Server.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Peer/Server.hs @@ -1,11 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE PatternSynonyms #-} -- | Bidirectional patterns for @'Peer' ps 'AsServer'@. The advantage of -- these patterns is that they automatically provide the 'RelativeAgencyEq' @@ -20,11 +13,11 @@ module Network.TypedProtocol.Stateful.Peer.Server , pattern Done ) where -import Data.Kind (Type) +import Data.Kind (Type) -import Network.TypedProtocol.Core -import Network.TypedProtocol.Stateful.Peer (Peer) -import qualified Network.TypedProtocol.Stateful.Peer as TP +import Network.TypedProtocol.Core +import Network.TypedProtocol.Stateful.Peer (Peer) +import Network.TypedProtocol.Stateful.Peer qualified as TP type Server :: forall ps diff --git a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Proofs.hs b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Proofs.hs similarity index 89% rename from typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Proofs.hs rename to typed-protocols/stateful/Network/TypedProtocol/Stateful/Proofs.hs index af1b3805..7e135e57 100644 --- a/typed-protocols-stateful/src/Network/TypedProtocol/Stateful/Proofs.hs +++ b/typed-protocols/stateful/Network/TypedProtocol/Stateful/Proofs.hs @@ -1,11 +1,4 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeFamilies #-} -- This is already implied by the -Wall in the .cabal file, but lets just be -- completely explicit about it too, since we rely on the completeness @@ -28,10 +21,10 @@ import Data.Kind (Type) import Data.Singletons import Network.TypedProtocol.Core -import Network.TypedProtocol.Stateful.Peer qualified as ST import Network.TypedProtocol.Peer import Network.TypedProtocol.Proofs (TerminalStates (..)) import Network.TypedProtocol.Proofs qualified as TP +import Network.TypedProtocol.Stateful.Peer qualified as ST diff --git a/typed-protocols-examples/test/Main.hs b/typed-protocols/test/Main.hs similarity index 51% rename from typed-protocols-examples/test/Main.hs rename to typed-protocols/test/Main.hs index 950738d6..783f6707 100644 --- a/typed-protocols-examples/test/Main.hs +++ b/typed-protocols/test/Main.hs @@ -1,9 +1,9 @@ module Main (main) where -import Test.Tasty +import Test.Tasty -import qualified Network.TypedProtocol.PingPong.Tests as PingPong -import qualified Network.TypedProtocol.ReqResp.Tests as ReqResp +import Network.TypedProtocol.PingPong.Tests qualified as PingPong +import Network.TypedProtocol.ReqResp.Tests qualified as ReqResp main :: IO () main = defaultMain tests diff --git a/typed-protocols-examples/test/Network/TypedProtocol/PingPong/Tests.hs b/typed-protocols/test/Network/TypedProtocol/PingPong/Tests.hs similarity index 90% rename from typed-protocols-examples/test/Network/TypedProtocol/PingPong/Tests.hs rename to typed-protocols/test/Network/TypedProtocol/PingPong/Tests.hs index 65dfabaf..2a486796 100644 --- a/typed-protocols-examples/test/Network/TypedProtocol/PingPong/Tests.hs +++ b/typed-protocols/test/Network/TypedProtocol/PingPong/Tests.hs @@ -1,9 +1,4 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} - +{-# LANGUAGE CPP #-} -- orphaned arbitrary instances {-# OPTIONS_GHC -Wno-orphans #-} @@ -16,39 +11,39 @@ module Network.TypedProtocol.PingPong.Tests ) where -import Network.TypedProtocol.Channel -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Driver.Simple -import Network.TypedProtocol.Proofs +import Network.TypedProtocol.Channel +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Driver.Simple +import Network.TypedProtocol.Proofs -import Network.TypedProtocol.PingPong.Client -import Network.TypedProtocol.PingPong.Codec -import qualified Network.TypedProtocol.PingPong.Codec.CBOR as CBOR -import Network.TypedProtocol.PingPong.Examples -import Network.TypedProtocol.PingPong.Server -import Network.TypedProtocol.PingPong.Type +import Network.TypedProtocol.PingPong.Client +import Network.TypedProtocol.PingPong.Codec +import Network.TypedProtocol.PingPong.Codec.CBOR qualified as CBOR +import Network.TypedProtocol.PingPong.Examples +import Network.TypedProtocol.PingPong.Server +import Network.TypedProtocol.PingPong.Type -import Control.Monad.Class.MonadAsync -import Control.Monad.Class.MonadSTM -import Control.Monad.Class.MonadThrow -import Control.Monad.IOSim (runSimOrThrow) -import Control.Monad.ST (runST) -import Control.Tracer (nullTracer) +import Control.Monad.Class.MonadAsync +import Control.Monad.Class.MonadSTM +import Control.Monad.Class.MonadThrow +import Control.Monad.IOSim (runSimOrThrow) +import Control.Monad.ST (runST) +import Control.Tracer (nullTracer) -import Data.Functor.Identity (Identity (..)) -import Data.List (inits, tails) +import Data.Functor.Identity (Identity (..)) +import Data.List (inits, tails) -import qualified Data.ByteString.Lazy as LBS +import Data.ByteString.Lazy qualified as LBS #if !defined(mingw32_HOST_OS) -import qualified Network.Socket as Socket -import System.Directory (removeFile) -import System.IO -import qualified System.Posix.Files as Posix +import Network.Socket qualified as Socket +import System.Directory (removeFile) +import System.IO +import System.Posix.Files qualified as Posix #endif -import Test.QuickCheck -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) +import Test.QuickCheck +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.QuickCheck (testProperty) -- diff --git a/typed-protocols-examples/test/Network/TypedProtocol/ReqResp/Tests.hs b/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs similarity index 85% rename from typed-protocols-examples/test/Network/TypedProtocol/ReqResp/Tests.hs rename to typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs index a58c21e0..6826e295 100644 --- a/typed-protocols-examples/test/Network/TypedProtocol/ReqResp/Tests.hs +++ b/typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs @@ -1,57 +1,48 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TupleSections #-} - +{-# LANGUAGE CPP #-} -- orphaned arbitrary instances {-# OPTIONS_GHC -Wno-orphans #-} - module Network.TypedProtocol.ReqResp.Tests (tests) where -import Network.TypedProtocol.Channel -import Network.TypedProtocol.Codec -import Network.TypedProtocol.Driver.Simple -import Network.TypedProtocol.Proofs - -import Network.TypedProtocol.ReqResp.Client -import Network.TypedProtocol.ReqResp.Codec -import qualified Network.TypedProtocol.ReqResp.Codec.CBOR as CBOR -import Network.TypedProtocol.ReqResp.Examples -import Network.TypedProtocol.ReqResp.Server -import Network.TypedProtocol.ReqResp.Type - -import Control.Exception (throw) -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) - -import Data.Functor.Identity (Identity (..)) -import Data.List (intercalate, mapAccumL) -import Data.Tuple (swap) +import Network.TypedProtocol.Channel +import Network.TypedProtocol.Codec +import Network.TypedProtocol.Driver.Simple +import Network.TypedProtocol.Proofs + +import Network.TypedProtocol.ReqResp.Client +import Network.TypedProtocol.ReqResp.Codec +import Network.TypedProtocol.ReqResp.Codec.CBOR qualified as CBOR +import Network.TypedProtocol.ReqResp.Examples +import Network.TypedProtocol.ReqResp.Server +import Network.TypedProtocol.ReqResp.Type + +import Control.Exception (throw) +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) + +import Data.Functor.Identity (Identity (..)) +import Data.List (intercalate, mapAccumL) +import Data.Tuple (swap) #if !defined(mingw32_HOST_OS) -import qualified Network.Socket as Socket -import System.Directory (removeFile) -import System.IO -import qualified System.Posix.Files as Posix +import Network.Socket qualified as Socket +import System.Directory (removeFile) +import System.IO +import System.Posix.Files qualified as Posix #endif -import Network.TypedProtocol.PingPong.Tests (splits2, splits2BS, - splits3, splits3BS) +import Network.TypedProtocol.PingPong.Tests (splits2, splits2BS, splits3, + splits3BS) -import Test.QuickCheck -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) -import Text.Show.Functions () +import Test.QuickCheck +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.QuickCheck (testProperty) +import Text.Show.Functions () -- diff --git a/typed-protocols/typed-protocols.cabal b/typed-protocols/typed-protocols.cabal index 5fb28990..5232146f 100644 --- a/typed-protocols/typed-protocols.cabal +++ b/typed-protocols/typed-protocols.cabal @@ -1,8 +1,8 @@ cabal-version: 3.4 name: typed-protocols -version: 0.4.0.0 +version: 1.0.0.0 synopsis: A framework for strongly typed protocols --- description: +description: A robust session type framework which supports protocol pipelining. license: Apache-2.0 license-files: LICENSE @@ -12,8 +12,9 @@ author: Alexander Vieth, Duncan Coutts, Marcin Szamotulski maintainer: alex@well-typed.com, duncan@well-typed.com, marcin.szamotulski@iohk.io category: Control build-type: Simple -tested-with: GHC == {8.10, 9.2, 9.4, 9.6, 9.8, 9.10} +tested-with: GHC == {9.6, 9.8, 9.10, 9.12} extra-doc-files: CHANGELOG.md + README.md library exposed-modules: Network.TypedProtocol @@ -25,21 +26,145 @@ library , 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 + ghc-options: -Wall + -Wno-unticked-promoted-constructors + -Wcompat + -Wincomplete-uni-patterns + -Wincomplete-record-updates + -Wpartial-fields + -Widentities + -Wredundant-constraints + +library cborg + visibility: public + exposed-modules: Network.TypedProtocol.Codec.CBOR - other-extensions: GADTs - , RankNTypes - , PolyKinds - , DataKinds - , ScopedTypeVariables - , TypeFamilies - , TypeOperators - , BangPatterns build-depends: base, - io-classes:io-classes ^>= 1.7, - singletons >= 3.0 + bytestring >=0.10 && <0.13, + cborg >=0.2.1 && <0.3, + singletons, + primitive, - hs-source-dirs: src - default-language: Haskell2010 + io-classes:io-classes, + typed-protocols:typed-protocols + + 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 + +library stateful + visibility: public + exposed-modules: Network.TypedProtocol.Stateful.Peer + , Network.TypedProtocol.Stateful.Peer.Client + , Network.TypedProtocol.Stateful.Peer.Server + , Network.TypedProtocol.Stateful.Driver + , Network.TypedProtocol.Stateful.Proofs + , Network.TypedProtocol.Stateful.Codec + build-depends: base, + 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, + + io-classes:io-classes, + typed-protocols:{typed-protocols,cborg,stateful} + + hs-source-dirs: stateful-cborg + default-language: GHC2021 + 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 + default-extensions: DataKinds + GADTs + LambdaCase ghc-options: -Wall -Wno-unticked-promoted-constructors -Wcompat @@ -48,3 +173,32 @@ library -Wpartial-fields -Widentities -Wredundant-constraints + +test-suite test + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: test + default-language: GHC2021 + 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 + + if !os(windows) + build-depends: directory + , network + , unix + + ghc-options: -rtsopts + -Wall + -Wno-unticked-promoted-constructors + -Wno-orphans