From f584509b44dffcc485c2c40c7a1f9d61a49bd977 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Thu, 31 Mar 2022 22:34:23 -0400 Subject: [PATCH] Add flake/HIE/README. --- .envrc | 1 + .gitignore | 12 ++++++++ README.md | 4 +-- flake.lock | 43 ++++++++++++++++++++++++++ flake.nix | 55 ++++++++++++++++++++++++++++++++++ fused-effects-exceptions.cabal | 2 +- hie.yaml | 2 ++ result | 1 + 8 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hie.yaml create mode 120000 result diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index ef86672..0c57904 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,15 @@ +# direnv +*.sw? +.direnv +.gopath +/direnv +/direnv.test +/dist +/test/config +/test/data +/test/scenarios/inherited/.envrc + +# fused-effects .stack-work dist-newstyle dist diff --git a/README.md b/README.md index 2023131..064c472 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # fused-effects-exceptions -[![Hackage](https://img.shields.io/hackage/v/fused-effects-exceptions.svg)](https://hackage.haskell.org/package/fused-effects-exceptions) [![BSD3 license](https://img.shields.io/badge/license-BSD3-blue.svg)](LICENSE) -[![Build Status](https://action-badges.now.sh/fused-effects/fused-effects-exceptions)](https://github.com/fused-effects/fused-effects-exceptions/actions) -This package provides `Control.Effect.Exception`, a module that wraps the [`Control.Exception`](http://hackage.haskell.org/package/base/docs/Control-Exception.html) API from `base` with the vocabulary provided by the [`fused-effects`](http://hackage.haskell.org/package/fused-effects) library. These functions interact with GHC's support for dynamic exceptions, including functions like `catch` for exception handling and `bracket` for resource management. +This fork provides `Control.Effect.Exception[.UnliftIO]`, a module that wraps the [`Control.Exception`](http://hackage.haskell.org/package/base/docs/Control-Exception.html) and [`UnliftIO.Exception`](https://hackage.haskell.org/package/unliftio-0.2.21.0/docs/UnliftIO-Exception.html) API from `base` with the vocabulary provided by the [`fused-effects`](http://hackage.haskell.org/package/fused-effects) library. These functions interact with GHC's support for dynamic exceptions, including functions like `catch` for exception handling and `bracket` for resource management. Please be aware that injudicious use of these functions may provoke surprising interactions with carriers that thread a monadic state as a parameter, à la the `Control.Carrier.State` types provided by `fused-effects`. For example, a function like `finally`, which does not thread any state from its body to its handler block, may discard state writes in cleanup handlers: diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f6fe38a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1648297722, + "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1648648646, + "narHash": "sha256-pHAq/GvsP7zRHkUTCs+4d31C0IEtTIuC6/TFASIA+zg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "efea022d6fe0da84aa6613d4ddeafb80de713457", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a92d6fe --- /dev/null +++ b/flake.nix @@ -0,0 +1,55 @@ +{ + description = "Handle exceptions thrown in IO with fused-effects."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils }: + let + name = "fused-effects-exceptions"; + in + { + overlay = final: prev: { + haskellPackages = prev.haskellPackages.override { + overrides = _self: _super: { + "${name}" = prev.haskellPackages.callCabal2nix name self { }; + }; + }; + }; + } // (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; + + haskell = { + ghc = pkgs.haskellPackages.ghc; + hls = pkgs.haskell-language-server.override { + supportedGhcVersions = [ "8107" ]; + }; + }; + in + with pkgs; { + packages = { + "${name}" = pkgs.haskellPackages.callCabal2nix name self { }; + }; + + defaultPackage = self.packages.${system}.${name}; + + devShell = mkShell { + buildInputs = [ + haskell.ghc + haskell.hls + gdb + haskellPackages.cabal-install + haskellPackages.stylish-haskell + ]; + }; + })); +} diff --git a/fused-effects-exceptions.cabal b/fused-effects-exceptions.cabal index 095de32..c48b598 100644 --- a/fused-effects-exceptions.cabal +++ b/fused-effects-exceptions.cabal @@ -47,7 +47,7 @@ test-suite test base , fused-effects-exceptions , fused-effects - , tasty ^>= 1.2 + , tasty ^>= 1.4 , tasty-hunit ^>= 0.10 , transformers diff --git a/hie.yaml b/hie.yaml new file mode 100644 index 0000000..04cd243 --- /dev/null +++ b/hie.yaml @@ -0,0 +1,2 @@ +cradle: + cabal: diff --git a/result b/result new file mode 120000 index 0000000..f8dc8ae --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/k0gb2rky5g5p3n9fgy637swkwd5szxdk-fused-effects-exceptions-1.1.0.2 \ No newline at end of file