From c23144b3d2b64446575c2cecabbba11e0813c626 Mon Sep 17 00:00:00 2001 From: Jens Nolte <git@queezle.net> Date: Fri, 8 Apr 2022 23:54:28 +0200 Subject: [PATCH] Support GHC 9.2.2 Co-authored-by: Jan Beinke <git@janbeinke.com> --- flake.lock | 12 +++++++----- flake.nix | 14 ++++++++++---- quasar.cabal | 1 + src/Quasar/Async.hs | 8 ++++---- src/Quasar/Async/Fork.hs | 4 ++-- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 9a3d812..d565bee 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,18 @@ "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" } }, "root": { diff --git a/flake.nix b/flake.nix index c056fc2..49742c4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,4 +1,8 @@ { + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; + }; + outputs = { self, nixpkgs }: with nixpkgs.lib; let @@ -7,7 +11,11 @@ in { packages = forAllSystems (system: let pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; }; - in { quasar = pkgs.haskellPackages.quasar; } + in rec { + default = ghc922.quasar; + quasar = pkgs.haskellPackages.quasar; + ghc922.quasar = pkgs.haskell.packages.ghc922.quasar; + } ); overlay = final: prev: { @@ -21,13 +29,11 @@ }; }; - defaultPackage = forAllSystems (system: self.packages.${system}.quasar); - devShell = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in pkgs.mkShell { - inputsFrom = pkgs.lib.mapAttrsToList (k: v: v.env or v) self.packages.${system}; + inputsFrom = [ self.packages.${system}.default.env ]; packages = [ pkgs.cabal-install pkgs.zsh diff --git a/quasar.cabal b/quasar.cabal index 5a450c0..8e02469 100644 --- a/quasar.cabal +++ b/quasar.cabal @@ -55,6 +55,7 @@ common shared-properties -Weverything -Wno-all-missed-specialisations -Wno-missing-safe-haskell-mode + -Wno-missing-kind-signatures -Wno-missing-import-lists -Wno-unsafe -Werror=incomplete-patterns diff --git a/src/Quasar/Async.hs b/src/Quasar/Async.hs index 3a51b99..d94a2af 100644 --- a/src/Quasar/Async.hs +++ b/src/Quasar/Async.hs @@ -44,10 +44,10 @@ instance IsFuture a (Async a) where async :: (MonadQuasar m, MonadIO m) => QuasarIO a -> m (Async a) -async fn = asyncWithUnmask ($ fn) +async fn = asyncWithUnmask (\unmask -> unmask fn) async_ :: (MonadQuasar m, MonadIO m) => QuasarIO () -> m () -async_ fn = void $ asyncWithUnmask ($ fn) +async_ fn = void $ asyncWithUnmask (\unmask -> unmask fn) asyncWithUnmask :: (MonadQuasar m, MonadIO m) => ((forall b. QuasarIO b -> QuasarIO b) -> QuasarIO a) -> m (Async a) asyncWithUnmask fn = do @@ -64,7 +64,7 @@ asyncWithUnmask_ fn = void $ asyncWithUnmask fn async' :: (MonadQuasar m, MonadIO m) => IO a -> m (Async a) -async' fn = asyncWithUnmask' ($ fn) +async' fn = asyncWithUnmask' (\unmask -> unmask fn) asyncWithUnmask' :: forall a m. (MonadQuasar m, MonadIO m) => ((forall b. IO b -> IO b) -> IO a) -> m (Async a) asyncWithUnmask' fn = liftQuasarIO do @@ -74,7 +74,7 @@ asyncWithUnmask' fn = liftQuasarIO do unmanagedAsync :: forall a m. MonadIO m => TIOWorker -> ExceptionSink -> IO a -> m (Async a) -unmanagedAsync worker exSink fn = liftIO $ unmanagedAsyncWithUnmask worker exSink ($ fn) +unmanagedAsync worker exSink fn = liftIO $ unmanagedAsyncWithUnmask worker exSink (\unmask -> unmask fn) unmanagedAsyncWithUnmask :: forall a m. MonadIO m => TIOWorker -> ExceptionSink -> ((forall b. IO b -> IO b) -> IO a) -> m (Async a) unmanagedAsyncWithUnmask worker exSink fn = liftIO $ spawnAsync (\_ -> pure ()) worker exSink fn diff --git a/src/Quasar/Async/Fork.hs b/src/Quasar/Async/Fork.hs index 151c874..6a58330 100644 --- a/src/Quasar/Async/Fork.hs +++ b/src/Quasar/Async/Fork.hs @@ -56,7 +56,7 @@ forkAsyncWithUnmaskSTM fn worker exChan = join <$> startShortIOSTM (unsafeShortI -- * Fork in IO, redirecting errors to an ExceptionSink fork :: IO () -> ExceptionSink -> IO ThreadId -fork fn exSink = forkWithUnmask ($ fn) exSink +fork fn exSink = forkWithUnmask (\unmask -> unmask fn) exSink fork_ :: IO () -> ExceptionSink -> IO () fork_ fn exSink = void $ fork fn exSink @@ -74,7 +74,7 @@ forkWithUnmask_ fn exChan = void $ forkWithUnmask fn exChan -- * Fork in IO while collecting the result, redirecting errors to an ExceptionSink forkFuture :: forall a. IO a -> ExceptionSink -> IO (Future a) -forkFuture fn = forkFutureWithUnmask ($ fn) +forkFuture fn = forkFutureWithUnmask (\unmask -> unmask fn) forkFutureWithUnmask :: forall a. ((forall b. IO b -> IO b) -> IO a) -> ExceptionSink -> IO (Future a) forkFutureWithUnmask fn exChan = do -- GitLab