diff --git a/flake.lock b/flake.lock index d7a23bbf7eb4f2bd2ed52bfa6397ff4a29ae0549..12afa7c5aa04c1f49f12804caa588aab053727aa 100644 --- a/flake.lock +++ b/flake.lock @@ -2,30 +2,34 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1645334861, - "narHash": "sha256-We9ECiMglthzbZ5S6Myqqf+RHzBFZPoM2qL5/jDkUjs=", + "lastModified": 1649225869, + "narHash": "sha256-u1zLtPmQzhT9mNXyM8Ey9pk7orDrIKdwooeGDEXm5xM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d5f237872975e6fb6f76eef1368b5634ffcd266f", + "rev": "b6966d911da89e5a7301aaef8b4f0a44c77e103c", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1645334861, - "narHash": "sha256-We9ECiMglthzbZ5S6Myqqf+RHzBFZPoM2qL5/jDkUjs=", + "lastModified": 1649225869, + "narHash": "sha256-u1zLtPmQzhT9mNXyM8Ey9pk7orDrIKdwooeGDEXm5xM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d5f237872975e6fb6f76eef1368b5634ffcd266f", + "rev": "b6966d911da89e5a7301aaef8b4f0a44c77e103c", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "quasar": { @@ -34,11 +38,11 @@ }, "locked": { "host": "git.c3pb.de", - "lastModified": 1649186839, - "narHash": "sha256-hYmuv40Wy302gWHvsEb8FGmMX1fxZlpq77SLE7UxQJQ=", + "lastModified": 1649454868, + "narHash": "sha256-64pCVdiy9hHR71I1d0w3tOVTs3y8tmmkbn/B2KNaHoM=", "owner": "jens", "repo": "quasar", - "rev": "82ebde4fe07002ba7c7a4d5bb4e21d63f30d4eef", + "rev": "c23144b3d2b64446575c2cecabbba11e0813c626", "type": "gitlab" }, "original": { diff --git a/flake.nix b/flake.nix index 74b50d0834cc0d2805e84875e3c963ecc620e6d6..858acaa06a6eb98651e5deca26e6a3ce6bf8e5c7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,6 @@ { inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; quasar = { url = gitlab:jens/quasar?host=git.c3pb.de; }; @@ -16,21 +17,22 @@ self.overlay quasar.overlay ]; }; - in { inherit (pkgs.haskellPackages) quasar-network; } + in rec { + default = quasar-network; + quasar-network = pkgs.haskell.packages.ghc922.quasar-network; + } ); - overlay = self: super: { - haskell = super.haskell // { - packageOverrides = hself: hsuper: super.haskell.packageOverrides hself hsuper // { - quasar-network = import ./. { pkgs = self; haskellPackages = hself; }; + overlay = final: prev: { + haskell = prev.haskell // { + packageOverrides = hfinal: hprev: prev.haskell.packageOverrides hfinal hprev // { + quasar-network = import ./. { pkgs = final; haskellPackages = hfinal; }; }; }; }; overlays.quasar = quasar.overlay; - defaultPackage = forAllSystems (system: self.packages.${system}.quasar-network); - devShell = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; diff --git a/quasar-network.cabal b/quasar-network.cabal index d40329c152c85b043ef027c937efb570961e4e15..c3d2e1de41aed52ab233b90804d229804bc66feb 100644 --- a/quasar-network.cabal +++ b/quasar-network.cabal @@ -20,54 +20,28 @@ source-repository head common shared-properties default-extensions: AllowAmbiguousTypes - BangPatterns BlockArguments - ConstraintKinds DataKinds DefaultSignatures DeriveAnyClass - DeriveGeneric DerivingStrategies DuplicateRecordFields - ExistentialQuantification - FlexibleContexts - FlexibleInstances FunctionalDependencies GADTs - GeneralizedNewtypeDeriving - ImportQualifiedPost - InstanceSigs LambdaCase - MultiParamTypeClasses - NamedFieldPuns + LexicalNegation NoImplicitPrelude + OverloadedRecordDot OverloadedStrings - PolyKinds - RankNTypes - ScopedTypeVariables - StandaloneDeriving TemplateHaskell - TupleSections - TypeApplications TypeFamilies - TypeOperators ViewPatterns - -- Required for the record-dot-preprocessor plugin - DuplicateRecordFields - TypeApplications - FlexibleContexts - DataKinds - MultiParamTypeClasses - TypeSynonymInstances - FlexibleInstances - UndecidableInstances - GADTs - default-language: Haskell2010 + default-language: GHC2021 ghc-options: - -fplugin=RecordDotPreprocessor -Weverything -Wno-all-missed-specialisations -Wno-missing-safe-haskell-mode + -Wno-missing-kind-signatures -Wno-missing-import-lists -Wno-unsafe -Werror=incomplete-patterns @@ -97,18 +71,13 @@ library async, binary, bytestring, - deepseq, exceptions, mtl, network, quasar, - stm, template-haskell, unix, unordered-containers, - -- required for record-dot-preprocessor - record-dot-preprocessor, - record-hasfield, hs-source-dirs: src @@ -129,9 +98,6 @@ test-suite quasar-network-test quasar, quasar-network, stm, - -- required for record-dot-preprocessor - record-dot-preprocessor, - record-hasfield, main-is: Spec.hs other-modules: Quasar.NetworkSpec diff --git a/src/Quasar/Network/Multiplexer.hs b/src/Quasar/Network/Multiplexer.hs index 692457d866018a8dfe5df75ac5a237adcd6ef911..c8190dfd739e735e183dc303c48a40e38ab5d421 100644 --- a/src/Quasar/Network/Multiplexer.hs +++ b/src/Quasar/Network/Multiplexer.hs @@ -1,6 +1,6 @@ module Quasar.Network.Multiplexer ( -- * Channel type - Channel, + Channel(quasar), -- * Sending and receiving messages MessageId, diff --git a/src/Quasar/Network/Runtime/Observable.hs b/src/Quasar/Network/Runtime/Observable.hs index cce2d3a919cac80e2513c49010f488c2803c17db..e61f65718cf0ab28deffa8a1ce934fea54d9abd9 100644 --- a/src/Quasar/Network/Runtime/Observable.hs +++ b/src/Quasar/Network/Runtime/Observable.hs @@ -40,7 +40,7 @@ data ObservableClient a = } instance IsRetrievable a (ObservableClient a) where - -- TODO use withResourceScope to abort on async exception (once supported by the code generator) + -- TODO use withResourceScope to abort on async exception (once aborting requests is supported by the code generator) retrieve client = liftIO $ client.beginRetrieve >>= await instance IsObservable a (ObservableClient a) where diff --git a/src/Quasar/Network/TH.hs b/src/Quasar/Network/TH.hs index 692638e18801ba76b777f92c71f7c8b1dc43aade..924997116d0b4826a49bf0ca380282aeaadb2edd 100644 --- a/src/Quasar/Network/TH.hs +++ b/src/Quasar/Network/TH.hs @@ -14,15 +14,14 @@ module Quasar.Network.TH ( makeRpc, -- TODO: re-add functions that generate only client and server later RpcProtocol(ProtocolRequest, ProtocolResponse), - HasProtocolImpl + HasProtocolImpl, ) where import Control.Monad.State (State, execState) import Control.Monad.State qualified as State import Data.Binary (Binary) -import GHC.Records.Compat (HasField) -import Language.Haskell.TH hiding (interruptible) -import Language.Haskell.TH.Syntax +import GHC.Records (HasField) +import Language.Haskell.TH hiding (Code, interruptible) import Quasar import Quasar.Network.Multiplexer import Quasar.Network.Runtime @@ -212,7 +211,7 @@ clientRequestStub api req = do requestDataE :: Q Exp requestDataE = applyVars (conE (requestConName api req)) messageConfigurationE :: Q Exp - messageConfigurationE = [|defaultMessageConfiguration{createChannels = $(litE $ integerL $ toInteger $ numPipelinedChannels req)}|] + messageConfigurationE = [|MessageConfiguration False $(litE $ integerL $ toInteger $ numPipelinedChannels req)|] sendE :: Q Exp -> Q Exp sendE msgExp = [|$typedSend $clientE $messageConfigurationE $msgExp|] requestE :: Response -> Q Exp -> Q Exp diff --git a/test/Quasar/NetworkSpec.hs b/test/Quasar/NetworkSpec.hs index b448a79f012a16f15ea6d440bd6c80aa53bff0b9..c6ae81f16e1e75d26716f7e90d7752be603bcd2e 100644 --- a/test/Quasar/NetworkSpec.hs +++ b/test/Quasar/NetworkSpec.hs @@ -16,6 +16,7 @@ import Quasar import Quasar.Network import Quasar.Network.Runtime (withStandaloneClient) import Quasar.Network.TH (makeRpc) +import Quasar.Network.Multiplexer import Quasar.Prelude import Test.Hspec.Core.Spec import Test.Hspec.Expectations.Lifted