From 422d506c1332f2dd68737fa61a4c5ffaef260a0c Mon Sep 17 00:00:00 2001 From: Jamie Bertram Date: Tue, 15 Mar 2022 08:55:25 -0600 Subject: [PATCH] Initial commit --- .envrc.example | 7 + .gitignore | 14 ++ .pre-commit-config.yaml | 1 + .purs-repl | 1 + .tidyoperators | 346 ++++++++++++++++++++++++++++++++++++++++ .tidyrc.json | 10 ++ LICENSE | 21 +++ README.md | 3 + flake.lock | 188 ++++++++++++++++++++++ flake.nix | 175 ++++++++++++++++++++ packages.dhall | 4 + spago.dhall | 5 + 12 files changed, 775 insertions(+) create mode 100644 .envrc.example create mode 100644 .gitignore create mode 120000 .pre-commit-config.yaml create mode 100644 .purs-repl create mode 100644 .tidyoperators create mode 100644 .tidyrc.json create mode 100644 LICENSE create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 packages.dhall create mode 100644 spago.dhall diff --git a/.envrc.example b/.envrc.example new file mode 100644 index 0000000..9b25572 --- /dev/null +++ b/.envrc.example @@ -0,0 +1,7 @@ +use_flake() { + watch_file flake.nix + watch_file flake.lock + eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")" +} + +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fcb4f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +/bower_components/ +/node_modules/ +/.pulp-cache/ +/output/ +/.psci* +/src/.webpack.js +/setupPath.sh +/.idea +/.spago +.psa-stash +.psc-ide-port +.direnv +.envrc +*.log diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 120000 index 0000000..7aa5c10 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +/nix/store/r7s3jvfc7xbn4vny6jrg0n8gayzs22f6-pre-commit-config.json \ No newline at end of file diff --git a/.purs-repl b/.purs-repl new file mode 100644 index 0000000..6802fc7 --- /dev/null +++ b/.purs-repl @@ -0,0 +1 @@ +import Prelude diff --git a/.tidyoperators b/.tidyoperators new file mode 100644 index 0000000..0d90a71 --- /dev/null +++ b/.tidyoperators @@ -0,0 +1,346 @@ +Control.Alt.($>) 4 +Control.Alt.(<#>) 1 +Control.Alt.(<$) 4 +Control.Alt.(<$>) 4 +Control.Alt.(<@>) 4 +Control.Alt.(<|>) 3 +Control.Alternative.($>) 4 +Control.Alternative.(*>) 4 +Control.Alternative.(<#>) 1 +Control.Alternative.(<$) 4 +Control.Alternative.(<$>) 4 +Control.Alternative.(<*) 4 +Control.Alternative.(<*>) 4 +Control.Alternative.(<@>) 4 +Control.Alternative.(<|>) 3 +Control.Applicative.($>) 4 +Control.Applicative.(*>) 4 +Control.Applicative.(<#>) 1 +Control.Applicative.(<$) 4 +Control.Applicative.(<$>) 4 +Control.Applicative.(<*) 4 +Control.Applicative.(<*>) 4 +Control.Applicative.(<@>) 4 +Control.Apply.($>) 4 +Control.Apply.(*>) 4 +Control.Apply.(<#>) 1 +Control.Apply.(<$) 4 +Control.Apply.(<$>) 4 +Control.Apply.(<*) 4 +Control.Apply.(<*>) 4 +Control.Apply.(<@>) 4 +Control.Biapply.(*>>) 4 +Control.Biapply.(<<$>>) 4 +Control.Biapply.(<<*) 4 +Control.Biapply.(<<*>>) 4 +Control.Bind.($>) 4 +Control.Bind.(*>) 4 +Control.Bind.(<#>) 1 +Control.Bind.(<$) 4 +Control.Bind.(<$>) 4 +Control.Bind.(<*) 4 +Control.Bind.(<*>) 4 +Control.Bind.(<=<) 1 +Control.Bind.(<@>) 4 +Control.Bind.(=<<) 1 +Control.Bind.(>=>) 1 +Control.Bind.(>>=) 1 +Control.Category.(<<<) 9 +Control.Category.(>>>) 9 +Control.Comonad.($>) 4 +Control.Comonad.(<#>) 1 +Control.Comonad.(<$) 4 +Control.Comonad.(<$>) 4 +Control.Comonad.(<<=) 1 +Control.Comonad.(<@>) 4 +Control.Comonad.(=<=) 1 +Control.Comonad.(=>=) 1 +Control.Comonad.(=>>) 1 +Control.Comonad.Cofree.(:<) 5 +Control.Extend.($>) 4 +Control.Extend.(<#>) 1 +Control.Extend.(<$) 4 +Control.Extend.(<$>) 4 +Control.Extend.(<<=) 1 +Control.Extend.(<@>) 4 +Control.Extend.(=<=) 1 +Control.Extend.(=>=) 1 +Control.Extend.(=>>) 1 +Control.Monad.($>) 4 +Control.Monad.(*>) 4 +Control.Monad.(<#>) 1 +Control.Monad.(<$) 4 +Control.Monad.(<$>) 4 +Control.Monad.(<*) 4 +Control.Monad.(<*>) 4 +Control.Monad.(<=<) 1 +Control.Monad.(<@>) 4 +Control.Monad.(=<<) 1 +Control.Monad.(>=>) 1 +Control.Monad.(>>=) 1 +Control.Monad.Morph.(<|<) 2 +Control.Monad.Morph.(=<|) 2 +Control.Monad.Morph.(>|>) 2 +Control.Monad.Morph.(|>=) 2 +Control.MonadPlus.($>) 4 +Control.MonadPlus.(*>) 4 +Control.MonadPlus.(<#>) 1 +Control.MonadPlus.(<$) 4 +Control.MonadPlus.(<$>) 4 +Control.MonadPlus.(<*) 4 +Control.MonadPlus.(<*>) 4 +Control.MonadPlus.(<=<) 1 +Control.MonadPlus.(<@>) 4 +Control.MonadPlus.(<|>) 3 +Control.MonadPlus.(=<<) 1 +Control.MonadPlus.(>=>) 1 +Control.MonadPlus.(>>=) 1 +Control.MonadZero.($>) 4 +Control.MonadZero.(*>) 4 +Control.MonadZero.(<#>) 1 +Control.MonadZero.(<$) 4 +Control.MonadZero.(<$>) 4 +Control.MonadZero.(<*) 4 +Control.MonadZero.(<*>) 4 +Control.MonadZero.(<=<) 1 +Control.MonadZero.(<@>) 4 +Control.MonadZero.(<|>) 3 +Control.MonadZero.(=<<) 1 +Control.MonadZero.(>=>) 1 +Control.MonadZero.(>>=) 1 +Control.Plus.($>) 4 +Control.Plus.(<#>) 1 +Control.Plus.(<$) 4 +Control.Plus.(<$>) 4 +Control.Plus.(<@>) 4 +Control.Plus.(<|>) 3 +Control.Semigroupoid.(<<<) 9 +Control.Semigroupoid.(>>>) 9 +Data.Argonaut.(.!=) 6 +Data.Argonaut.(.:) 7 +Data.Argonaut.(.:!) 7 +Data.Argonaut.(.:?) 7 +Data.Argonaut.(:=) 7 +Data.Argonaut.(:=?) 7 +Data.Argonaut.(~>) 6 +Data.Argonaut.(~>?) 6 +Data.Argonaut.Decode.(.!=) 6 +Data.Argonaut.Decode.(.:) 7 +Data.Argonaut.Decode.(.:!) 7 +Data.Argonaut.Decode.(.:?) 7 +Data.Argonaut.Decode.Combinators.(.!=) 6 +Data.Argonaut.Decode.Combinators.(.:) 7 +Data.Argonaut.Decode.Combinators.(.:!) 7 +Data.Argonaut.Decode.Combinators.(.:?) 7 +Data.Argonaut.Encode.(:=) 7 +Data.Argonaut.Encode.(:=?) 7 +Data.Argonaut.Encode.(~>) 6 +Data.Argonaut.Encode.(~>?) 6 +Data.Argonaut.Encode.Combinators.(:=) 7 +Data.Argonaut.Encode.Combinators.(:=?) 7 +Data.Argonaut.Encode.Combinators.(~>) 6 +Data.Argonaut.Encode.Combinators.(~>?) 6 +Data.Array.(!!) 8 +Data.Array.(..) 8 +Data.Array.(:) 6 +Data.Array.(\\) 5 +Data.Array.NonEmpty.(!!) 8 +Data.Array.NonEmpty.(..) 8 +Data.Array.NonEmpty.(:) 6 +Data.Array.NonEmpty.(\\) 5 +Data.BooleanAlgebra.(&&) 3 +Data.BooleanAlgebra.(||) 2 +Data.Bounded.(<) 4 +Data.Bounded.(<=) 4 +Data.Bounded.(>) 4 +Data.Bounded.(>=) 4 +Data.CommutativeRing.(*) 7 +Data.CommutativeRing.(+) 6 +Data.CommutativeRing.(-) 6 +Data.DivisionRing.(*) 7 +Data.DivisionRing.(+) 6 +Data.DivisionRing.(-) 6 +Data.Either.Nested.(\/) type 6 +Data.Either.Nested.(\/) 6 +Data.Eq.(/=) 4 +Data.Eq.(==) 4 +Data.EuclideanRing.(*) 7 +Data.EuclideanRing.(+) 6 +Data.EuclideanRing.(-) 6 +Data.EuclideanRing.(/) 7 +Data.Field.(*) 7 +Data.Field.(+) 6 +Data.Field.(-) 6 +Data.Field.(/) 7 +Data.Function.(#) 1 +Data.Function.($) 0 +Data.Function.(<<<) 9 +Data.Function.(>>>) 9 +Data.Functor.($>) 4 +Data.Functor.(<#>) 1 +Data.Functor.(<$) 4 +Data.Functor.(<$>) 4 +Data.Functor.(<@>) 4 +Data.Functor.Contravariant.(>#<) 4 +Data.Functor.Contravariant.(>$<) 4 +Data.Functor.Coproduct.Nested.(<\/>) type 6 +Data.Functor.Coproduct.Nested.(<\/>) 6 +Data.Functor.Product.Nested.() type 6 +Data.Functor.Product.Nested.() 6 +Data.HeytingAlgebra.(&&) 3 +Data.HeytingAlgebra.(||) 2 +Data.Int.Bits.(.&.) 10 +Data.Int.Bits.(.^.) 10 +Data.Int.Bits.(.|.) 10 +Data.Lens.(%=) 4 +Data.Lens.(%~) 4 +Data.Lens.(&&&) 3 +Data.Lens.(&&=) 4 +Data.Lens.(&&~) 4 +Data.Lens.(***) 3 +Data.Lens.(*=) 4 +Data.Lens.(*~) 4 +Data.Lens.(+++) 2 +Data.Lens.(+=) 4 +Data.Lens.(+~) 4 +Data.Lens.(-=) 4 +Data.Lens.(-~) 4 +Data.Lens.(.=) 4 +Data.Lens.(.~) 4 +Data.Lens.(//=) 4 +Data.Lens.(//~) 4 +Data.Lens.(<>=) 4 +Data.Lens.(<>~) 4 +Data.Lens.(?=) 4 +Data.Lens.(?~) 4 +Data.Lens.(^.) 8 +Data.Lens.(^..) 8 +Data.Lens.(^?) 8 +Data.Lens.(||=) 4 +Data.Lens.(|||) 2 +Data.Lens.(||~) 4 +Data.Lens.Common.(&&&) 3 +Data.Lens.Common.(***) 3 +Data.Lens.Common.(+++) 2 +Data.Lens.Common.(|||) 2 +Data.Lens.Fold.(^..) 8 +Data.Lens.Fold.(^?) 8 +Data.Lens.Fold.Partial.(^?!) 8 +Data.Lens.Fold.Partial.(^@?!) 8 +Data.Lens.Getter.(^.) 8 +Data.Lens.Lens.Tuple.(&&&) 3 +Data.Lens.Lens.Tuple.(***) 3 +Data.Lens.Prism.Either.(+++) 2 +Data.Lens.Prism.Either.(|||) 2 +Data.Lens.Setter.(%=) 4 +Data.Lens.Setter.(%~) 4 +Data.Lens.Setter.(&&=) 4 +Data.Lens.Setter.(&&~) 4 +Data.Lens.Setter.(*=) 4 +Data.Lens.Setter.(*~) 4 +Data.Lens.Setter.(+=) 4 +Data.Lens.Setter.(+~) 4 +Data.Lens.Setter.(-=) 4 +Data.Lens.Setter.(-~) 4 +Data.Lens.Setter.(.=) 4 +Data.Lens.Setter.(.~) 4 +Data.Lens.Setter.(//=) 4 +Data.Lens.Setter.(//~) 4 +Data.Lens.Setter.(<>=) 4 +Data.Lens.Setter.(<>~) 4 +Data.Lens.Setter.(?=) 4 +Data.Lens.Setter.(?~) 4 +Data.Lens.Setter.(||=) 4 +Data.Lens.Setter.(||~) 4 +Data.List.(!!) 8 +Data.List.(..) 8 +Data.List.(:) 6 +Data.List.(\\) 5 +Data.List.Lazy.(!!) 8 +Data.List.Lazy.(..) 8 +Data.List.Lazy.(:) 6 +Data.List.Lazy.(\\) 5 +Data.List.Lazy.NonEmpty.(:) 6 +Data.List.Lazy.Types.(:) 6 +Data.List.NonEmpty.(!!) 8 +Data.List.NonEmpty.(:) 6 +Data.List.Types.(:) 6 +Data.Monoid.(<>) 5 +Data.NaturalTransformation.(~>) type 4 +Data.NonEmpty.(:|) 5 +Data.Number.Approximate.(~=) 4 +Data.Number.Approximate.(≅) 4 +Data.Number.Approximate.(≇) 4 +Data.Ord.(<) 4 +Data.Ord.(<=) 4 +Data.Ord.(>) 4 +Data.Ord.(>=) 4 +Data.Profunctor.Choice.(+++) 2 +Data.Profunctor.Choice.(|||) 2 +Data.Profunctor.Strong.(&&&) 3 +Data.Profunctor.Strong.(***) 3 +Data.Ring.(*) 7 +Data.Ring.(+) 6 +Data.Ring.(-) 6 +Data.Semigroup.(<>) 5 +Data.Semiring.(*) 7 +Data.Semiring.(+) 6 +Data.Tuple.Nested.(/\) type 6 +Data.Tuple.Nested.(/\) 6 +Foreign.Index.(!) 9 +Math.(%) 7 +Pipes.(<-<) 7 +Pipes.(<~) 4 +Pipes.(>->) 7 +Pipes.(>~) 5 +Pipes.(~<) 5 +Pipes.(~>) 4 +Pipes.Core.(+>>) 6 +Pipes.Core.(//<) 4 +Pipes.Core.(//>) 4 +Pipes.Core.(//) 4 +Pipes.Core.(<+<) 7 +Pipes.Core.(<<+) 6 +Pipes.Core.(<\\) 3 +Pipes.Core.(<~<) 8 +Pipes.Core.(>+>) 7 +Pipes.Core.(>>~) 7 +Pipes.Core.(>\\) 5 +Pipes.Core.(>~>) 8 +Pipes.Core.(\<\) 4 +Pipes.Core.(\>\) 4 +Pipes.Core.(~<<) 7 +Prelude.(~>) type 4 +Prelude.(#) 1 +Prelude.($) 0 +Prelude.($>) 4 +Prelude.(&&) 3 +Prelude.(*) 7 +Prelude.(*>) 4 +Prelude.(+) 6 +Prelude.(-) 6 +Prelude.(/) 7 +Prelude.(/=) 4 +Prelude.(<) 4 +Prelude.(<#>) 1 +Prelude.(<$) 4 +Prelude.(<$>) 4 +Prelude.(<*) 4 +Prelude.(<*>) 4 +Prelude.(<<<) 9 +Prelude.(<=) 4 +Prelude.(<=<) 1 +Prelude.(<>) 5 +Prelude.(<@>) 4 +Prelude.(=<<) 1 +Prelude.(==) 4 +Prelude.(>) 4 +Prelude.(>=) 4 +Prelude.(>=>) 1 +Prelude.(>>=) 1 +Prelude.(>>>) 9 +Prelude.(||) 2 +Type.Function.($) type 0 +Type.Prelude.(+) type 0 +Type.Row.(+) type 0 diff --git a/.tidyrc.json b/.tidyrc.json new file mode 100644 index 0000000..678acf3 --- /dev/null +++ b/.tidyrc.json @@ -0,0 +1,10 @@ +{ + "importSort": "ide", + "importWrap": "auto", + "indent": 2, + "operatorsFile": ".tidyoperators", + "ribbon": 1, + "typeArrowPlacement": "first", + "unicode": "never", + "width": 80 +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6a6d77c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 PureScript Contrib + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbc275a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# purescript-unlift + +MonadBase, MonadUnlift, MonadUnliftEffect, and MonadUnliftAff diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..23a5c8e --- /dev/null +++ b/flake.lock @@ -0,0 +1,188 @@ +{ + "nodes": { + "easy-purescript-nix": { + "flake": false, + "locked": { + "lastModified": 1646209831, + "narHash": "sha256-or8Z6aMWdrqcmFA0hhjjb6FIiW14C0ruwXAqy+zYZ8g=", + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "rev": "aa72388ca0fb72ed64467f59a121db1f104897db", + "type": "github" + }, + "original": { + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1619345332, + "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646480205, + "narHash": "sha256-kekOlTlu45vuK2L9nq8iVN17V3sB0WWPqTTW3a2SQG0=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "bff2832ec341cf30acb3a4d3e2e7f1f7b590116a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1639947939, + "narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=", + "owner": "nix-community", + "repo": "naersk", + "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1647321545, + "narHash": "sha256-alnh5Pc73jdXAiN17G9AfhYEf2aURsTMXa/DXLiA3MI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "be872a7453a176df625c12190b8a6c10f6b21647", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1647321545, + "narHash": "sha256-alnh5Pc73jdXAiN17G9AfhYEf2aURsTMXa/DXLiA3MI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "be872a7453a176df625c12190b8a6c10f6b21647", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646153636, + "narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "rnix-lsp": { + "inputs": { + "naersk": "naersk", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1647240246, + "narHash": "sha256-/MLdBWfFUN1C1eNVBYfaVAIcDiZKXpWEbzBC2pqVXj0=", + "owner": "nix-community", + "repo": "rnix-lsp", + "rev": "4d1024ccfe1bc569811769d1ef52a2fc6c1d482d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "rnix-lsp", + "type": "github" + } + }, + "root": { + "inputs": { + "easy-purescript-nix": "easy-purescript-nix", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "rnix-lsp": "rnix-lsp" + } + }, + "utils": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0c7be7e --- /dev/null +++ b/flake.nix @@ -0,0 +1,175 @@ +{ + description = "MonadBase, MonadUnlift, MonadUnliftEffect, and MonadUnliftAff"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + easy-purescript-nix = { + url = "github:justinwoo/easy-purescript-nix"; + flake = false; + }; + rnix-lsp = { + url = "github:nix-community/rnix-lsp"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, pre-commit-hooks, flake-utils, easy-purescript-nix, rnix-lsp, gitignore }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { inherit system; }; + easy-ps = import easy-purescript-nix { inherit pkgs; }; + spagoPkgs = import ./spago-packages.nix { inherit pkgs; }; + + inherit (gitignore.lib) gitignoreSource; + inherit (easy-ps) dhall-simple purs-tidy spago psa purs; + inherit (pkgs) git writeShellScriptBin nodePackages mkShell nodejs nixpkgs-fmt; + inherit (nodePackages) prettier; + inherit (builtins) concatStringsSep; + + src = gitignoreSource ./.; + + + writeShellScriptBinInRepoRoot = name: script: writeShellScriptBin name '' + cd `${git}/bin/git rev-parse --show-toplevel` + ${script} + ''; + + extensionsToRegex = extensions: "\\.(${concatStringsSep "|" extensions})"; + + formatter = name: cmd: extensions: '' + echo formatting with ${name} + ${git}/bin/git ls-files | grep -E '${extensionsToRegex extensions}' | xargs -d $'\\n' ${cmd} + ''; + + dhall-batch = writeShellScriptBin "dhall" '' + for f in "$@"; do ${dhall-simple}/bin/dhall format --inplace $f; done + ''; + + purs-tidy-hook = { + enable = true; + name = "purs-tidy"; + entry = "${purs-tidy}/bin/purs-tidy format-in-place"; + files = "\\.purs$"; + language = "system"; + }; + + dhall-hook = { + enable = true; + name = "dhall"; + entry = "${dhall-batch}/bin/dhall"; + files = "\\.dhall$"; + language = "system"; + }; + + prettier-hook = { + enable = true; + types_or = [ "javascript" "css" "html" ]; + }; + + pre-commit-check = pre-commit-hooks.lib.${system}.run { + inherit src; + hooks = { + nixpkgs-fmt = { + enable = true; + excludes = [ ".*spago-packages.nix$" ]; + }; + prettier = prettier-hook; + inherit purs-tidy-hook dhall-hook; + }; + }; + + clean = writeShellScriptBinInRepoRoot "clean" '' + echo cleaning project... + rm -rf .spago .spago2nix output .psa-stash + echo removed .spago + echo removed .spago2nix + echo removed .psa-stash + echo removed output + echo done. + ''; + + psa-args = "--strict --stash --censor-lib"; + + runSpago = cmd: '' + ${spago}/bin/spago ${cmd} --purs-args "${psa-args} --stash" + ''; + + getGlob = { name, version, ... }: ''".spago/${name}/${version}/src/**/*.purs"''; + + spagoSources = + builtins.toString + (builtins.map getGlob (builtins.attrValues spagoPkgs.inputs)); + + build = writeShellScriptBin "build" (runSpago "build"); + test = writeShellScriptBin "test" (runSpago "test"); + clean-build = writeShellScriptBin "clean-build" '' + ${clean}/bin/clean + ${build}/bin/build + ''; + + format = writeShellScriptBin "format" '' + set -e + ${formatter "purs-tidy" "${purs-tidy}/bin/purs-tidy format-in-place" ["purs"]} + ${formatter "dhall" "${dhall-batch}/bin/dhall" ["dhall"]} + ${formatter "prettier" "${prettier}/bin/prettier -w" ["js" "ts" "css" "html"] + } + echo done. + ''; + + unlift = + pkgs.stdenv.mkDerivation { + name = "purescript-unlift"; + buildInputs = [ + spagoPkgs.installSpagoStyle + ]; + nativeBuildInputs = [ psa purs nodejs ]; + inherit src; + unpackPhase = '' + cp $src . + install-spago-style + ''; + buildPhase = '' + set -e + echo building project... + psa compile ${psa-args} ${spagoSources} "./src/**/*.purs" + echo done. + ''; + installPhase = '' + mkdir $out + mv output $out/ + ''; + doCheck = true; + checkPhase = '' + psa compile ${psa-args} ${spagoSources} "./src/**/*.purs" "./test/**/*.purs" + node ./test.js + ''; + }; + + in + { + defaultPackage = unlift; + devShell = mkShell { + buildInputs = [ + build + clean + clean-build + format + nixpkgs-fmt + rnix-lsp.defaultPackage."${system}" + test + ] ++ easy-ps.buildInputs; + inherit (pre-commit-check) shellHook; + }; + } + ); +} diff --git a/packages.dhall b/packages.dhall new file mode 100644 index 0000000..ab08528 --- /dev/null +++ b/packages.dhall @@ -0,0 +1,4 @@ +let upstream = + https://github.com/purescript/package-sets/releases/download/psc-0.14.7-20220303/packages.dhall sha256:d7cbc15ea16768e4a4f99baa58a54559dd2648c6c1362de2469d9e41c23b28c3 + +in upstream diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..216f999 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,5 @@ +{ name = "servant-support" +, dependencies = [] +, packages = ./packages.dhall +, sources = [ "src/**/*.purs" ] +}