diff --git a/flake.lock b/flake.lock index 9a3d812b4952e9253400d46858536458c7dcc138..d565beef605f2ad93eebf0e5115683e835529632 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 c056fc2e04066bc2ef953538500f84fc0f5f7a30..49742c47c25a8046445a1e12f640ef253f3a287f 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 5a450c0a5cd0d515c5cb85dc59d35e4d343e5338..8e024692a5c69f7cc814e05c06e9680a7c7d5c33 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 3a51b99182e08d598dfab7ce3c6abf3ffab11a9f..d94a2affbe409762fed3ddda29a92790fe2b1241 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 151c874fcea085040729201fe0f98d51f92cdd75..6a58330211e7873ad8d8f41cf646bf5d72368d7c 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