diff --git a/.github/workflows/bundle-ucm.yaml b/.github/workflows/bundle-ucm.yaml index d77ba14030..db53c80ac0 100644 --- a/.github/workflows/bundle-ucm.yaml +++ b/.github/workflows/bundle-ucm.yaml @@ -39,6 +39,8 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main + with: + stack-version: 2.15.5 - name: build run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 51f1f720f3..55e88ddbaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -102,6 +102,8 @@ jobs: - name: install stack if: steps.cache-ucm-binaries.outputs.cache-hit != 'true' uses: unisonweb/actions/stack/install@main + with: + stack-version: 2.15.5 # Build deps, then build local code. Splitting it into two steps just allows us to see how much time each step # takes. diff --git a/.github/workflows/haddocks.yaml b/.github/workflows/haddocks.yaml index 4b9179e562..2fb12dad65 100644 --- a/.github/workflows/haddocks.yaml +++ b/.github/workflows/haddocks.yaml @@ -27,6 +27,8 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main + with: + stack-version: 2.15.5 - name: build with haddocks working-directory: unison diff --git a/.github/workflows/nix-dev-cache.yaml b/.github/workflows/nix-dev-cache.yaml index e4e7aa4987..9ee02af326 100644 --- a/.github/workflows/nix-dev-cache.yaml +++ b/.github/workflows/nix-dev-cache.yaml @@ -37,4 +37,4 @@ jobs: name: unison authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: build all packages and development shells - run: nix -L build --accept-flake-config --no-link --keep-going '.#build-tools' + run: nix -L build --accept-flake-config --no-link --keep-going '.#all' diff --git a/.github/workflows/update-transcripts.yaml b/.github/workflows/update-transcripts.yaml index 68b7ec1e92..90c206d045 100644 --- a/.github/workflows/update-transcripts.yaml +++ b/.github/workflows/update-transcripts.yaml @@ -22,6 +22,8 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main + with: + stack-version: 2.15.5 # One of the transcripts fails if the user's git name hasn't been set. - name: set git user info diff --git a/codebase2/util-serialization/U/Util/Serialization.hs b/codebase2/util-serialization/U/Util/Serialization.hs index ecc90fe439..82d49e1408 100644 --- a/codebase2/util-serialization/U/Util/Serialization.hs +++ b/codebase2/util-serialization/U/Util/Serialization.hs @@ -8,7 +8,7 @@ module U.Util.Serialization where -import Control.Applicative (Applicative (liftA2), liftA3) +import Control.Applicative (liftA3) import Control.Monad (foldM, replicateM, replicateM_, when) import Data.Bits (Bits, clearBit, setBit, shiftL, shiftR, testBit, (.|.)) import Data.ByteString (ByteString, readFile, writeFile) diff --git a/contrib/cabal.project b/contrib/cabal.project index 246669424d..d23809d841 100644 --- a/contrib/cabal.project +++ b/contrib/cabal.project @@ -28,7 +28,9 @@ packages: parser-typechecker unison-core unison-cli + unison-cli-main unison-hashing-v2 + unison-merge unison-share-api unison-share-projects-api unison-syntax @@ -45,10 +47,12 @@ source-repository-package tag: 9275eea7982dabbf47be2ba078ced669ae7ef3d5 constraints: - fsnotify < 0.4, - crypton-x509-store <= 1.6.8, - servant <= 0.19.1, - optparse-applicative <= 0.17.1.0 + lsp == 2.3.0.0, + fsnotify == 0.4.1.0, + crypton-x509-store == 1.6.9, + servant == 0.20.1, + optparse-applicative == 0.18.1.0, + tls == 1.8.0 -- For now there is no way to apply ghc-options for all local packages -- See https://cabal.readthedocs.io/en/latest/cabal-project.html#package-configuration-options @@ -127,6 +131,9 @@ package unison-core package unison-hashing-v2 ghc-options: -Wall -Werror -Wno-name-shadowing -Wno-type-defaults -Wno-missing-pattern-synonym-signatures -fprint-expanded-synonyms -fwrite-ide-info +package unison-merge + ghc-options: -Wall -Werror -Wno-name-shadowing -Wno-type-defaults -Wno-missing-pattern-synonym-signatures -fprint-expanded-synonyms -fwrite-ide-info + package unison-share-api ghc-options: -Wall -Werror -Wno-name-shadowing -Wno-type-defaults -Wno-missing-pattern-synonym-signatures -fprint-expanded-synonyms -fwrite-ide-info diff --git a/flake.lock b/flake.lock index d4ece12a51..4c07d21e1a 100644 --- a/flake.lock +++ b/flake.lock @@ -135,51 +135,14 @@ "type": "github" } }, - "ghc98X": { - "flake": false, - "locked": { - "lastModified": 1696643148, - "narHash": "sha256-E02DfgISH7EvvNAu0BHiPvl1E5FGMDi0pWdNZtIBC9I=", - "ref": "ghc-9.8", - "rev": "443e870d977b1ab6fc05f47a9a17bc49296adbd6", - "revCount": 61642, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "ref": "ghc-9.8", - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, - "ghc99": { - "flake": false, - "locked": { - "lastModified": 1697054644, - "narHash": "sha256-kKarOuXUaAH3QWv7ASx+gGFMHaHKe0pK5Zu37ky2AL4=", - "ref": "refs/heads/master", - "rev": "f383a242c76f90bcca8a4d7ee001dcb49c172a9a", - "revCount": 62040, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, "hackage": { "flake": false, "locked": { - "lastModified": 1699402991, - "narHash": "sha256-2nQBlA3ygBiIqVPh2J1JwP51rEO0xMjyoOaoJk5PboY=", + "lastModified": 1719535035, + "narHash": "sha256-kCCfZytGgkRYlsiNe/dwLAnpNOvfywpjVl61hO/8l2M=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "9e963602a5b3259dac9cf5e994f0a338fb352b7e", + "rev": "66f23365685f71610460f3c2c0dfa91f96c532ac", "type": "github" }, "original": { @@ -197,14 +160,16 @@ "cardano-shell": "cardano-shell", "flake-compat": "flake-compat", "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "ghc98X": "ghc98X", - "ghc99": "ghc99", "hackage": "hackage", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", + "hls-2.5": "hls-2.5", + "hls-2.6": "hls-2.6", + "hls-2.7": "hls-2.7", + "hls-2.8": "hls-2.8", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -218,16 +183,17 @@ "nixpkgs-2205": "nixpkgs-2205", "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1699404571, - "narHash": "sha256-EwI7vKBxCHvIKPWbvGlOF9IZlSFqPODgT/BQy8Z2s/w=", + "lastModified": 1719535822, + "narHash": "sha256-IteIKK4+GEZI2nHqCz0zRVgQ3aqs/WXKTOt2sbHJmGk=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "cec253ca482301509e9e90cb5c15299dd3550cce", + "rev": "72bc84d0a4e8d0536505628040d96fd0a9e16c70", "type": "github" }, "original": { @@ -307,16 +273,84 @@ "hls-2.4": { "flake": false, "locked": { - "lastModified": 1696939266, - "narHash": "sha256-VOMf5+kyOeOmfXTHlv4LNFJuDGa7G3pDnOxtzYR40IU=", + "lastModified": 1699862708, + "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.4.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.5": { + "flake": false, + "locked": { + "lastModified": 1701080174, + "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.5.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.6": { + "flake": false, + "locked": { + "lastModified": 1705325287, + "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.6.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.7": { + "flake": false, + "locked": { + "lastModified": 1708965829, + "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.7.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.8": { + "flake": false, + "locked": { + "lastModified": 1715153580, + "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "362fdd1293efb4b82410b676ab1273479f6d17ee", + "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", "type": "github" }, "original": { "owner": "haskell", - "ref": "2.4.0.0", + "ref": "2.8.0.0", "repo": "haskell-language-server", "type": "github" } @@ -363,18 +397,18 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1691634696, - "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", - "ref": "hkm/remote-iserv", - "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", - "revCount": 14, - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "lastModified": 1717479972, + "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "2ed34002247213fc435d0062350b91bab920626e", + "type": "github" }, "original": { - "ref": "hkm/remote-iserv", - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" } }, "lowdown-src": { @@ -512,11 +546,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1695416179, - "narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=", + "lastModified": 1701362232, + "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6", + "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", "type": "github" }, "original": { @@ -526,6 +560,22 @@ "type": "github" } }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1701386440, + "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -542,35 +592,35 @@ "type": "github" } }, - "nixpkgs-unstable": { + "nixpkgs-release": { "locked": { - "lastModified": 1695318763, - "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", + "lastModified": 1719520878, + "narHash": "sha256-5BXzNOl2RVHcfS/oxaZDKOi7gVuTyWPibQG0DHd5sSc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", + "rev": "a44bedbb48c367f0476e6a3a27bf28f6330faf23", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "release-24.05", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-unstable_2": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1699781429, - "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", + "lastModified": 1694822471, + "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", "repo": "nixpkgs", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -595,21 +645,21 @@ "inputs": { "flake-utils": "flake-utils", "haskellNix": "haskellNix", - "nixpkgs": [ + "nixpkgs-haskellNix": [ "haskellNix", "nixpkgs-unstable" ], - "nixpkgs-unstable": "nixpkgs-unstable_2" + "nixpkgs-release": "nixpkgs-release" } }, "stackage": { "flake": false, "locked": { - "lastModified": 1699402155, - "narHash": "sha256-fOywUFLuAuZAkIrv1JdjGzfY53uEiMRlu8UpdJtCjh0=", + "lastModified": 1719102283, + "narHash": "sha256-pon+cXgMWPlCiBx9GlRcjsjTHbCc8fDVgOGb3Z7qhRM=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "7c7bfe8cca23c96b850e16f3c0b159aca1850314", + "rev": "7df45e0bd9852810d8070f9c5257f8e7a4677b91", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8c8725da3b..0be2f8da81 100644 --- a/flake.nix +++ b/flake.nix @@ -8,17 +8,17 @@ inputs = { haskellNix.url = "github:input-output-hk/haskell.nix"; - nixpkgs.follows = "haskellNix/nixpkgs-unstable"; - nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs-haskellNix.follows = "haskellNix/nixpkgs-unstable"; + nixpkgs-release.url = "github:NixOS/nixpkgs/release-24.05"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, - nixpkgs, - flake-utils, haskellNix, - nixpkgs-unstable, + nixpkgs-haskellNix, + nixpkgs-release, + flake-utils, }: flake-utils.lib.eachSystem [ "x86_64-linux" @@ -27,99 +27,55 @@ ] (system: let versions = { - ghc = "928"; - ormolu = "0.5.2.0"; - hls = "2.4.0.0"; - stack = "2.13.1"; + ormolu = "0.7.2.0"; + hls = "2.8.0.0"; + stack = "2.15.7"; hpack = "0.35.2"; }; - overlays = [ - haskellNix.overlay - (import ./nix/haskell-nix-overlay.nix) - (import ./nix/unison-overlay.nix) - ]; - pkgs = import nixpkgs { - inherit system overlays; - inherit (haskellNix) config; - }; - haskell-nix-flake = import ./nix/haskell-nix-flake.nix { - inherit pkgs versions; - inherit (nixpkgs-packages) stack hpack; - }; - unstable = import nixpkgs-unstable { + pkgs = import nixpkgs-haskellNix { inherit system; + inherit (haskellNix) config; overlays = [ - (import ./nix/unison-overlay.nix) - (import ./nix/nixpkgs-overlay.nix {inherit versions;}) + haskellNix.overlay + (import ./nix/dependencies.nix {inherit nixpkgs-release;}) ]; }; - nixpkgs-packages = let - hpkgs = unstable.haskell.packages.ghcunison; - exe = unstable.haskell.lib.justStaticExecutables; - in { - ghc = unstable.haskell.compiler."ghc${versions.ghc}"; - ormolu = exe hpkgs.ormolu; - hls = unstable.unison-hls; - stack = unstable.unison-stack; - unwrapped-stack = unstable.stack; - hpack = unstable.hpack; + unison-project = import ./nix/unison-project.nix { + inherit (nixpkgs-haskellNix) lib; + inherit (pkgs) haskell-nix; }; - nixpkgs-devShells = { - only-tools-nixpkgs = unstable.mkShell { - name = "only-tools-nixpkgs"; - buildInputs = let - build-tools = with nixpkgs-packages; [ - ghc - ormolu - hls - stack - hpack - ]; - native-packages = - pkgs.lib.optionals pkgs.stdenv.isDarwin - (with unstable.darwin.apple_sdk.frameworks; [Cocoa]); - c-deps = with unstable; [pkg-config zlib glibcLocales]; - in - build-tools ++ c-deps ++ native-packages; - shellHook = '' - export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH - ''; - }; + haskell-nix-flake = import ./nix/haskell-nix-flake.nix { + inherit pkgs unison-project versions; + inherit (nixpkgs-haskellNix) lib; }; - renameAttrs = fn: - nixpkgs.lib.mapAttrs' (name: value: { + nixpkgs-haskellNix.lib.mapAttrs' (name: value: { inherit value; name = fn name; }); in - assert nixpkgs-packages.ormolu.version == versions.ormolu; - assert nixpkgs-packages.hls.version == versions.hls; - assert nixpkgs-packages.unwrapped-stack.version == versions.stack; - assert nixpkgs-packages.hpack.version == versions.hpack; { + assert pkgs.stack.version == versions.stack; + assert pkgs.hpack.version == versions.hpack; { packages = - nixpkgs-packages - // renameAttrs (name: "component-${name}") haskell-nix-flake.packages + renameAttrs (name: "component-${name}") haskell-nix-flake.packages // renameAttrs (name: "docker-${name}") (import ./nix/docker.nix { inherit pkgs; haskell-nix = haskell-nix-flake.packages; }) // { default = haskell-nix-flake.defaultPackage; - build-tools = pkgs.symlinkJoin { - name = "build-tools"; - paths = self.devShells."${system}".only-tools-nixpkgs.buildInputs; - }; all = pkgs.symlinkJoin { name = "all"; paths = let - all-other-packages = builtins.attrValues (builtins.removeAttrs self.packages."${system}" ["all" "build-tools"]); + all-other-packages = + builtins.attrValues (builtins.removeAttrs self.packages."${system}" [ + "all" + "docker-ucm" # this package doesn’t produce a directory + ]); devshell-inputs = builtins.concatMap (devShell: devShell.buildInputs ++ devShell.nativeBuildInputs) - [ - self.devShells."${system}".only-tools-nixpkgs - ]; + (builtins.attrValues self.devShells."${system}"); in all-other-packages ++ devshell-inputs; }; @@ -130,9 +86,8 @@ // {default = self.apps."${system}"."component-unison-cli-main:exe:unison";}; devShells = - nixpkgs-devShells - // renameAttrs (name: "cabal-${name}") haskell-nix-flake.devShells - // {default = self.devShells."${system}".only-tools-nixpkgs;}; + renameAttrs (name: "cabal-${name}") haskell-nix-flake.devShells + // {default = self.devShells."${system}".cabal-local;}; checks = renameAttrs (name: "component-${name}") haskell-nix-flake.checks; diff --git a/lib/unison-pretty-printer/src/Unison/Util/SyntaxText.hs b/lib/unison-pretty-printer/src/Unison/Util/SyntaxText.hs index 294a27b5bb..ffcac47acf 100644 --- a/lib/unison-pretty-printer/src/Unison/Util/SyntaxText.hs +++ b/lib/unison-pretty-printer/src/Unison/Util/SyntaxText.hs @@ -4,7 +4,7 @@ import Unison.HashQualified (HashQualified) import Unison.Name (Name) import Unison.Pattern (SeqOp) import Unison.Prelude -import Unison.Referent' (Referent') +import Unison.ReferentPrime (Referent') import Unison.Util.AnnotatedText (AnnotatedText (..), annotate, segment) type SyntaxText' r = AnnotatedText (Element r) diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs index d749559298..7b8a077b20 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs @@ -172,7 +172,7 @@ execute conn@(Connection _ _ conn0) sql@(Sql s params) = do -- -- This function does not support parameters, and is mostly useful for executing DDL and migrations. executeStatements :: HasCallStack => Connection -> Text -> IO () -executeStatements conn@(Connection _ _ (Sqlite.Connection database)) sql = do +executeStatements conn@(Connection _ _ (Sqlite.Connection database _tempNameCounter)) sql = do logQuery (Sql sql []) Nothing Direct.Sqlite.exec database sql `catch` \(exception :: Sqlite.SQLError) -> throwSqliteQueryException diff --git a/nix/dependencies.nix b/nix/dependencies.nix new file mode 100644 index 0000000000..7df873660f --- /dev/null +++ b/nix/dependencies.nix @@ -0,0 +1,21 @@ +{nixpkgs-release}: final: prev: let + pinned-pkgs = import nixpkgs-release {inherit (final) system;}; +in { + stack = pinned-pkgs.stack; + + ## See https://docs.haskellstack.org/en/stable/nix_integration/#supporting-both-nix-and-non-nix-developers for an + ## explanation of this package. + stack-wrapped = final.symlinkJoin { + name = "stack"; # will be available as the usual `stack` in terminal + paths = [final.stack]; + buildInputs = [final.makeWrapper]; + postBuild = '' + wrapProgram $out/bin/stack \ + --add-flags "\ + --no-nix \ + --system-ghc \ + --no-install-ghc \ + " + ''; + }; +} diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index c0c992ae01..25930790c1 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -1,10 +1,10 @@ { - stack, - hpack, + lib, pkgs, + unison-project, versions, }: let - haskell-nix-flake = pkgs.unison-project.flake {}; + haskell-nix-flake = unison-project.flake {}; commonShellArgs = args: args // { @@ -15,10 +15,12 @@ additional = hpkgs: with hpkgs; [Cabal stm exceptions ghc ghc-heap]; buildInputs = let native-packages = - pkgs.lib.optionals pkgs.stdenv.isDarwin + lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [Cocoa]); in - (args.buildInputs or []) ++ [stack hpack pkgs.pkg-config pkgs.zlib pkgs.glibcLocales] ++ native-packages; + (args.buildInputs or []) + ++ [pkgs.stack-wrapped pkgs.hpack pkgs.pkg-config pkgs.zlib pkgs.glibcLocales] + ++ native-packages; # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/11042 shellHook = '' export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH @@ -49,49 +51,42 @@ }; }; - shellFor = args: pkgs.unison-project.shellFor (commonShellArgs args); + shellFor = args: unison-project.shellFor (commonShellArgs args); - localPackages = with pkgs.lib; filterAttrs (k: v: v.isLocal or false) pkgs.unison-project.hsPkgs; - localPackageNames = builtins.attrNames localPackages; - devShells = let - mkDevShell = pkgName: - shellFor { - packages = hpkgs: [hpkgs."${pkgName}"]; - withHoogle = true; - }; - localPackageDevShells = - pkgs.lib.genAttrs localPackageNames mkDevShell; - in - { - only-tools = shellFor { - packages = _: []; - withHoogle = false; - }; - local = shellFor { - packages = hpkgs: (map (p: hpkgs."${p}") localPackageNames); - withHoogle = false; - }; - } - // localPackageDevShells; - - checks = - haskell-nix-flake.checks - // { - ## This check has a test that tries to write to $HOME, so we give it a fake one. - "unison-cli:test:cli-tests" = haskell-nix-flake.checks."unison-cli:test:cli-tests".overrideAttrs (old: { - ## The builder here doesn’t `runHook preBuild`, so we just prepend onto `buildPhase`. - buildPhase = - '' - export HOME="$TMP/fake-home" - mkdir -p "$HOME" - '' - + old.buildPhase or ""; - }); - }; + localPackages = lib.filterAttrs (k: v: v.isLocal or false) unison-project.hsPkgs; in haskell-nix-flake // { + checks = + haskell-nix-flake.checks + // { + ## This check has a test that tries to write to $HOME, so we give it a fake one. + "unison-cli:test:cli-tests" = haskell-nix-flake.checks."unison-cli:test:cli-tests".overrideAttrs (old: { + ## The builder here doesn’t `runHook preBuild`, so we just prepend onto `buildPhase`. + buildPhase = + '' + export HOME="$TMP/fake-home" + mkdir -p "$HOME" + '' + + old.buildPhase or ""; + }); + }; + defaultPackage = haskell-nix-flake.packages."unison-cli-main:exe:unison"; - inherit (pkgs) unison-project; - inherit checks devShells localPackageNames; + + devShells = let + mkDevShell = pkg: + shellFor { + packages = _hpkgs: [pkg]; + ## Enabling Hoogle causes us to rebuild GHC. + withHoogle = false; + }; + in + { + local = shellFor { + packages = _hpkgs: builtins.attrValues localPackages; + withHoogle = false; + }; + } + // pkgs.lib.mapAttrs (_name: mkDevShell) localPackages; } diff --git a/nix/haskell-nix-overlay.nix b/nix/haskell-nix-overlay.nix deleted file mode 100644 index b98ee874f2..0000000000 --- a/nix/haskell-nix-overlay.nix +++ /dev/null @@ -1,41 +0,0 @@ -final: prev: { - unison-project = with prev.lib.strings; let - cleanSource = pth: let - src' = prev.lib.cleanSourceWith { - filter = filt; - src = pth; - }; - filt = path: type: let - bn = baseNameOf path; - isHiddenFile = hasPrefix "." bn; - isFlakeLock = bn == "flake.lock"; - isNix = hasSuffix ".nix" bn; - in - !isHiddenFile && !isFlakeLock && !isNix; - in - src'; - in - final.haskell-nix.project' { - src = cleanSource ./..; - projectFileName = "stack.yaml"; - modules = [ - # enable profiling - { - enableLibraryProfiling = true; - profilingDetail = "none"; - } - # remove buggy build tool dependencies - ({lib, ...}: { - # this component has the build tool - # `unison-cli:unison` and somehow haskell.nix - # decides to add some file sharing package - # `unison` as a build-tool dependency. - packages.unison-cli.components.exes.cli-integration-tests.build-tools = lib.mkForce []; - }) - ]; - branchMap = { - "https://github.com/unisonweb/configurator.git"."e47e9e9fe1f576f8c835183b9def52d73c01327a" = "unison"; - "https://github.com/unisonweb/shellmet.git"."2fd348592c8f51bb4c0ca6ba4bc8e38668913746" = "topic/avoid-callCommand"; - }; - }; -} diff --git a/nix/nixpkgs-overlay.nix b/nix/nixpkgs-overlay.nix deleted file mode 100644 index 033ee5e881..0000000000 --- a/nix/nixpkgs-overlay.nix +++ /dev/null @@ -1,49 +0,0 @@ -{versions}: final: prev: { - unison-hls = final.haskell-language-server.override { - # build with our overridden haskellPackages that have our pinned - # version of ormolu and hls - haskellPackages = final.haskell.packages."ghc${versions.ghc}"; - dynamic = true; - supportedGhcVersions = [versions.ghc]; - }; - haskell = - prev.haskell - // { - packages = - prev.haskell.packages - // { - ghcunison = prev.haskell.packages."ghc${versions.ghc}".extend (hfinal: hprev: let - inherit (prev.haskell.lib) overrideCabal; - in { - # dependency overrides for ormolu 0.5.2.0 - haskell-language-server = let - p = - hfinal.callHackageDirect - { - pkg = "haskell-language-server"; - ver = versions.hls; - sha256 = "0kp586yc162raljyd5arsxm5ndcx5zfw9v94v27bkjg7x0hp1s8b"; - } - { - hls-fourmolu-plugin = null; - hls-stylish-haskell-plugin = null; - hls-hlint-plugin = null; - hls-floskell-plugin = null; - }; - override = drv: { - doCheck = false; - configureFlags = - (drv.configureFlags or []) - ++ [ - "-f-fourmolu" - "-f-stylishhaskell" - "-f-hlint" - "-f-floskell" - ]; - }; - in - overrideCabal p override; - }); - }; - }; -} diff --git a/nix/unison-overlay.nix b/nix/unison-overlay.nix deleted file mode 100644 index 5f7f1a336d..0000000000 --- a/nix/unison-overlay.nix +++ /dev/null @@ -1,15 +0,0 @@ -final: prev: { - # a wrapped version of stack that passes the necessary flags to use - # the nix provided ghc. - unison-stack = prev.symlinkJoin { - name = "stack"; - paths = [final.stack]; - buildInputs = [final.makeWrapper]; - postBuild = let - flags = ["--no-nix" "--system-ghc" "--no-install-ghc"]; - add-flags = "--add-flags '${prev.lib.concatStringsSep " " flags}'"; - in '' - wrapProgram "$out/bin/stack" ${add-flags} - ''; - }; -} diff --git a/nix/unison-project.nix b/nix/unison-project.nix new file mode 100644 index 0000000000..aa191a5a44 --- /dev/null +++ b/nix/unison-project.nix @@ -0,0 +1,31 @@ +{ + haskell-nix, + lib, +}: let + cleanSource = src: + lib.cleanSourceWith { + inherit src; + filter = path: type: let + bn = baseNameOf path; + isHiddenFile = lib.hasPrefix "." bn; + isFlakeLock = bn == "flake.lock"; + isNix = lib.hasSuffix ".nix" bn; + in + !isHiddenFile && !isFlakeLock && !isNix; + }; +in + haskell-nix.project' { + src = cleanSource ./..; + projectFileName = "stack.yaml"; + modules = [ + # enable profiling + { + enableLibraryProfiling = true; + profilingDetail = "none"; + } + ]; + branchMap = { + "https://github.com/unisonweb/configurator.git"."e47e9e9fe1f576f8c835183b9def52d73c01327a" = "unison"; + "https://github.com/unisonweb/shellmet.git"."2fd348592c8f51bb4c0ca6ba4bc8e38668913746" = "topic/avoid-callCommand"; + }; + } diff --git a/parser-typechecker/package.yaml b/parser-typechecker/package.yaml index c9de6f37d4..de5bbd70e3 100644 --- a/parser-typechecker/package.yaml +++ b/parser-typechecker/package.yaml @@ -20,7 +20,6 @@ when: dependencies: - ListLike - - NanoID - aeson - ansi-terminal - asn1-encoding @@ -81,7 +80,7 @@ dependencies: - nonempty-containers - open-browser - openapi3 - - optparse-applicative >= 0.16.1.0 + - optparse-applicative - pem - pretty-simple - primitive @@ -139,9 +138,9 @@ dependencies: - warp - witch - witherable - - x509 - - x509-store - - x509-system + - crypton-x509 + - crypton-x509-store + - crypton-x509-system - yaml - zlib diff --git a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs index aff8f08c1b..192bf8147c 100644 --- a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs +++ b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs @@ -25,8 +25,8 @@ import Unison.Codebase.Branch (Branch, Branch0) import Unison.Codebase.Branch qualified as Branch import Unison.Codebase.Path (Path) import Unison.Codebase.Path qualified as Path -import Unison.HashQualified' (HashQualified (HashQualified, NameOnly)) import Unison.NameSegment (NameSegment) +import Unison.HashQualifiedPrime (HashQualified (HashQualified, NameOnly)) import Unison.Names (Names) import Unison.Names qualified as Names import Unison.Prelude diff --git a/parser-typechecker/src/Unison/Codebase/Path.hs b/parser-typechecker/src/Unison/Codebase/Path.hs index b38c4edc99..d35a339990 100644 --- a/parser-typechecker/src/Unison/Codebase/Path.hs +++ b/parser-typechecker/src/Unison/Codebase/Path.hs @@ -94,7 +94,7 @@ import Data.Sequence (Seq ((:<|), (:|>))) import Data.Sequence qualified as Seq import Data.Text qualified as Text import GHC.Exts qualified as GHC -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment (NameSegment) diff --git a/parser-typechecker/src/Unison/Codebase/Path/Parse.hs b/parser-typechecker/src/Unison/Codebase/Path/Parse.hs index e5411d4ad3..79bb738e6d 100644 --- a/parser-typechecker/src/Unison/Codebase/Path/Parse.hs +++ b/parser-typechecker/src/Unison/Codebase/Path/Parse.hs @@ -22,7 +22,7 @@ import Text.Megaparsec qualified as P import Text.Megaparsec.Char qualified as P (char) import Text.Megaparsec.Internal qualified as P (withParsecT) import Unison.Codebase.Path -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Prelude hiding (empty, toList) import Unison.ShortHash (ShortHash) import Unison.Syntax.Lexer qualified as Lexer diff --git a/parser-typechecker/src/Unison/Codebase/ProjectPath.hs b/parser-typechecker/src/Unison/Codebase/ProjectPath.hs index 2714c44e4a..651f7f2ca5 100644 --- a/parser-typechecker/src/Unison/Codebase/ProjectPath.hs +++ b/parser-typechecker/src/Unison/Codebase/ProjectPath.hs @@ -44,7 +44,7 @@ data ProjectPathG proj branch = ProjectPath branch :: branch, absPath :: Path.Absolute } - deriving stock (Eq, Ord, Show, Generic) + deriving stock (Eq, Functor, Ord, Show, Generic) type ProjectPathIds = ProjectPathG ProjectId ProjectBranchId diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs index 76e7a67121..066c4c03a9 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs @@ -73,7 +73,7 @@ import Unison.Pattern qualified as Pattern import Unison.Prelude import Unison.Reference qualified as Reference import Unison.Referent qualified as Referent -import Unison.Referent' qualified as Referent' +import Unison.ReferentPrime qualified as Referent' import Unison.Sqlite qualified as Sqlite import Unison.Symbol (Symbol) import Unison.Term qualified as Term diff --git a/parser-typechecker/src/Unison/PrettyPrintEnv.hs b/parser-typechecker/src/Unison/PrettyPrintEnv.hs index 07fa935074..005bce8472 100644 --- a/parser-typechecker/src/Unison/PrettyPrintEnv.hs +++ b/parser-typechecker/src/Unison/PrettyPrintEnv.hs @@ -28,7 +28,7 @@ import Unison.ConstructorReference (ConstructorReference) import Unison.ConstructorType qualified as CT import Unison.HashQualified (HashQualified) import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.LabeledDependency qualified as LD import Unison.Name (Name) diff --git a/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs b/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs index 4d511091eb..5d8264202c 100644 --- a/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs +++ b/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs @@ -18,7 +18,7 @@ module Unison.PrettyPrintEnv.Names where import Data.Set qualified as Set -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.Names (Names) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index 16ea2dc881..5647ccde63 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -33,7 +33,7 @@ import Unison.ABT qualified as ABT import Unison.Builtin.Decls (unitRef, pattern TupleType') import Unison.ConstructorReference (ConstructorReference, GConstructorReference (..)) import Unison.HashQualified (HashQualified) -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Kind (Kind) import Unison.Kind qualified as Kind import Unison.KindInference.Error.Pretty (prettyKindError) diff --git a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs index b4e04d40cc..6bb4b315f2 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs @@ -20,10 +20,10 @@ import Data.Serialize.Put (runPutLazy) import Data.Text (Text) import Data.Word (Word16, Word32, Word64) import GHC.Stack +import GHC.IsList qualified (fromList) import Unison.ABT.Normalized (Term (..)) import Unison.Reference (Reference, Reference' (Builtin), pattern Derived) import Unison.Runtime.ANF as ANF hiding (Tag) -import Unison.Runtime.Array qualified as PA import Unison.Runtime.Exception import Unison.Runtime.Serialize import Unison.Util.EnumContainers qualified as EC @@ -682,7 +682,7 @@ getBLit v = NegT -> Neg <$> getPositive CharT -> Char <$> getChar FloatT -> Float <$> getFloat - ArrT -> Arr . PA.fromList <$> getList (getValue v) + ArrT -> Arr . GHC.IsList.fromList <$> getList (getValue v) putRefs :: (MonadPut m) => [Reference] -> m () putRefs rs = putFoldable putReference rs diff --git a/parser-typechecker/src/Unison/Runtime/Array.hs b/parser-typechecker/src/Unison/Runtime/Array.hs index 2faa68903a..a067d93383 100644 --- a/parser-typechecker/src/Unison/Runtime/Array.hs +++ b/parser-typechecker/src/Unison/Runtime/Array.hs @@ -56,7 +56,7 @@ import Data.Primitive.PrimArray as EPA hiding import Data.Primitive.PrimArray qualified as PA import Data.Primitive.Types import Data.Word (Word8) -import GHC.Exts (toList) +import GHC.IsList (toList ) #ifdef ARRAY_CHECK import GHC.Stack diff --git a/parser-typechecker/src/Unison/Runtime/MCode.hs b/parser-typechecker/src/Unison/Runtime/MCode.hs index 28f821f231..c3d9c837bb 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode.hs @@ -36,7 +36,6 @@ module Unison.Runtime.MCode ) where -import Control.Applicative (liftA2) import Data.Bifunctor (bimap, first) import Data.Bits (shiftL, shiftR, (.|.)) import Data.Coerce diff --git a/parser-typechecker/src/Unison/Runtime/Serialize.hs b/parser-typechecker/src/Unison/Runtime/Serialize.hs index 622fc11e79..1d1213cc45 100644 --- a/parser-typechecker/src/Unison/Runtime/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/Serialize.hs @@ -2,7 +2,6 @@ module Unison.Runtime.Serialize where -import Control.Applicative (liftA2) import Control.Monad (replicateM) import Data.Bits (Bits) import Data.ByteString qualified as B diff --git a/parser-typechecker/src/Unison/Syntax/NamePrinter.hs b/parser-typechecker/src/Unison/Syntax/NamePrinter.hs index ab51847469..8c3a70708d 100644 --- a/parser-typechecker/src/Unison/Syntax/NamePrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/NamePrinter.hs @@ -2,7 +2,7 @@ module Unison.Syntax.NamePrinter where import Data.Text qualified as Text import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.LabeledDependency qualified as LD import Unison.Name (Name) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 2c20b59fa3..9e5b23f701 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -31,7 +31,7 @@ import Unison.Builtin.Decls qualified as DD import Unison.ConstructorReference (ConstructorReference, GConstructorReference (..)) import Unison.ConstructorType qualified as CT import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment qualified as NameSegment diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index fcbbb296b8..3ec03464fd 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -35,7 +35,7 @@ import Unison.ConstructorReference (GConstructorReference (..)) import Unison.ConstructorReference qualified as ConstructorReference import Unison.ConstructorType qualified as CT import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment (NameSegment) diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Path.hs b/parser-typechecker/tests/Unison/Test/Codebase/Path.hs index 96fb0aca65..77cb80718e 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Path.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Path.hs @@ -6,7 +6,7 @@ import Data.Maybe (fromJust) import EasyTest import Unison.Codebase.Path (Path (..), Path' (..), Relative (..)) import Unison.Codebase.Path.Parse (parseHQSplit', parseShortHashOrHQSplit') -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.NameSegment.Internal (NameSegment (NameSegment)) import Unison.Prelude import Unison.ShortHash qualified as SH diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 7139bd1d02..018ec3eb7b 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -224,7 +224,6 @@ library build-depends: IntervalMap , ListLike - , NanoID , aeson , ansi-terminal , asn1-encoding @@ -244,6 +243,9 @@ library , concurrent-output , configurator , containers >=0.6.3 + , crypton-x509 + , crypton-x509-store + , crypton-x509-system , cryptonite , data-default , data-memocombinators @@ -284,7 +286,7 @@ library , nonempty-containers , open-browser , openapi3 - , optparse-applicative >=0.16.1.0 + , optparse-applicative , pem , pretty-simple , primitive @@ -342,9 +344,6 @@ library , warp , witch , witherable - , x509 - , x509-store - , x509-system , yaml , zlib default-language: Haskell2010 @@ -419,7 +418,6 @@ test-suite parser-typechecker-tests build-depends: IntervalMap , ListLike - , NanoID , aeson , ansi-terminal , asn1-encoding @@ -440,6 +438,9 @@ test-suite parser-typechecker-tests , concurrent-output , configurator , containers >=0.6.3 + , crypton-x509 + , crypton-x509-store + , crypton-x509-system , cryptonite , data-default , data-memocombinators @@ -483,7 +484,7 @@ test-suite parser-typechecker-tests , nonempty-containers , open-browser , openapi3 - , optparse-applicative >=0.16.1.0 + , optparse-applicative , pem , pretty-simple , primitive @@ -543,9 +544,6 @@ test-suite parser-typechecker-tests , warp , witch , witherable - , x509 - , x509-store - , x509-system , yaml , zlib default-language: Haskell2010 diff --git a/stack.yaml b/stack.yaml index ba6491bc91..19668b74ca 100644 --- a/stack.yaml +++ b/stack.yaml @@ -43,7 +43,7 @@ packages: - unison-syntax - yaks/easytest -resolver: lts-20.26 +resolver: lts-22.26 extra-deps: # broken version in snapshot @@ -57,16 +57,14 @@ extra-deps: commit: 9275eea7982dabbf47be2ba078ced669ae7ef3d5 # not in stackage - - fuzzyfind-3.0.1 + - fuzzyfind-3.0.2@sha256:0fcd64eb1016fe0d0232abc26b2b80b32d676707ff41d155a28df8a9572603d4,1921 - guid-0.1.0@sha256:a7c975be473f6f142d5cc1b39bc807a99043d20b1bb0873fdfe7a3ce84d2faf1,1078 - lock-file-0.7.0.0@sha256:3ad84b5e454145e1d928063b56abb96db24a99a21b493989520e58fa0ab37b00,4484 - - monad-validate-1.2.0.0@sha256:9850f408431098b28806dd464b6825a88a0b56c84f380d7fe0454c1df9d6f881,3505 - - recover-rtti-0.4.2@sha256:c179a303921126d8d782264e14f386c96e54a270df74be002e4c4ec3c8c7aebd,4529 - - lsp-2.2.0.0@sha256:82fbf4b69d94d8d22543be71f89986b3e90050032d671fb3de3f8253ea1e5b6f,3550 - - lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421 + - monad-validate-1.3.0.0@sha256:eb6ddd5c9cf72ff0563cba604fa00291376e96138fdb4932d00ff3a99d66706e,2605 + - recover-rtti-0.4.3@sha256:01adcbab70a6542914df28ac120a23a923d8566236f2c0295998e9419f53dd62,4672 - numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430 - row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071 - - network-udp-0.0.0 + - network-udp-0.0.0@sha256:408d2d4fa1a25e49e95752ee124cca641993404bb133ae10fb81daef22d876ae,1075 allow-newer: true allow-newer-deps: diff --git a/stack.yaml.lock b/stack.yaml.lock index 52d2861560..61c24795ea 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -27,12 +27,12 @@ packages: original: url: https://github.com/unisonweb/haskeline/archive/9275eea7982dabbf47be2ba078ced669ae7ef3d5.tar.gz - completed: - hackage: fuzzyfind-3.0.1@sha256:78f89c1d79adf0a15fa2e57c693d42b4765ccfbbe380d0c9d7da6bff9f124f85,1823 + hackage: fuzzyfind-3.0.2@sha256:0fcd64eb1016fe0d0232abc26b2b80b32d676707ff41d155a28df8a9572603d4,1921 pantry-tree: - sha256: 46f001ec2725d3172161c993bc8fbcf0514e3ba736f868fe2c2655e1ff49dad1 + sha256: 5bb9d39dbc4a619cf9b65409dde0d58dd488c7abab030f71ac83ba849595ee05 size: 542 original: - hackage: fuzzyfind-3.0.1 + hackage: fuzzyfind-3.0.2@sha256:0fcd64eb1016fe0d0232abc26b2b80b32d676707ff41d155a28df8a9572603d4,1921 - completed: hackage: guid-0.1.0@sha256:a7c975be473f6f142d5cc1b39bc807a99043d20b1bb0873fdfe7a3ce84d2faf1,1078 pantry-tree: @@ -48,33 +48,19 @@ packages: original: hackage: lock-file-0.7.0.0@sha256:3ad84b5e454145e1d928063b56abb96db24a99a21b493989520e58fa0ab37b00,4484 - completed: - hackage: monad-validate-1.2.0.0@sha256:9850f408431098b28806dd464b6825a88a0b56c84f380d7fe0454c1df9d6f881,3505 + hackage: monad-validate-1.3.0.0@sha256:eb6ddd5c9cf72ff0563cba604fa00291376e96138fdb4932d00ff3a99d66706e,2605 pantry-tree: - sha256: 8e049bd12ce2bd470909578f2ee8eb80b89d5ff88860afa30e29dd4eafecfa3e - size: 713 + sha256: 0b2a3a57be48fcc739708b214fca202f1e95b1cd773dd3bb9589d3007cf8cf5e + size: 611 original: - hackage: monad-validate-1.2.0.0@sha256:9850f408431098b28806dd464b6825a88a0b56c84f380d7fe0454c1df9d6f881,3505 + hackage: monad-validate-1.3.0.0@sha256:eb6ddd5c9cf72ff0563cba604fa00291376e96138fdb4932d00ff3a99d66706e,2605 - completed: - hackage: recover-rtti-0.4.2@sha256:c179a303921126d8d782264e14f386c96e54a270df74be002e4c4ec3c8c7aebd,4529 + hackage: recover-rtti-0.4.3@sha256:01adcbab70a6542914df28ac120a23a923d8566236f2c0295998e9419f53dd62,4672 pantry-tree: - sha256: ad6f24481ebd25a1456d5dfaf08d48d95394ce83eb82a267e01d87d34f13bb83 - size: 2488 + sha256: 59a5df9c88f83816a9826b1e9708153d06d64bd1aed6c1d71ef0a1f6db070599 + size: 2489 original: - hackage: recover-rtti-0.4.2@sha256:c179a303921126d8d782264e14f386c96e54a270df74be002e4c4ec3c8c7aebd,4529 -- completed: - hackage: lsp-2.2.0.0@sha256:82fbf4b69d94d8d22543be71f89986b3e90050032d671fb3de3f8253ea1e5b6f,3550 - pantry-tree: - sha256: 88ea35fb71d377c035770d5f0d6a3aea51919223e3bc1e492deb6f7d9cda3a85 - size: 1043 - original: - hackage: lsp-2.2.0.0@sha256:82fbf4b69d94d8d22543be71f89986b3e90050032d671fb3de3f8253ea1e5b6f,3550 -- completed: - hackage: lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421 - pantry-tree: - sha256: 7a3f0b679066d5e4732dfa358d76e0969589d636f4012c9e87cbe3451aa3ee5e - size: 45527 - original: - hackage: lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421 + hackage: recover-rtti-0.4.3@sha256:01adcbab70a6542914df28ac120a23a923d8566236f2c0295998e9419f53dd62,4672 - completed: hackage: numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430 pantry-tree: @@ -95,10 +81,10 @@ packages: sha256: ee19a66c9d420861c5cc1dfad3210e2a53cdc6088ff3dd90b44f7961f5caebee size: 284 original: - hackage: network-udp-0.0.0 + hackage: network-udp-0.0.0@sha256:408d2d4fa1a25e49e95752ee124cca641993404bb133ae10fb81daef22d876ae,1075 snapshots: - completed: - sha256: 5a59b2a405b3aba3c00188453be172b85893cab8ebc352b1ef58b0eae5d248a2 - size: 650475 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/26.yaml - original: lts-20.26 + sha256: 8e7996960d864443a66eb4105338bbdd6830377b9f6f99cd5527ef73c10c01e7 + size: 719128 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/26.yaml + original: lts-22.26 diff --git a/unison-cli/src/ArgParse.hs b/unison-cli/src/ArgParse.hs index 0b354f9f57..90ec1f9ee7 100644 --- a/unison-cli/src/ArgParse.hs +++ b/unison-cli/src/ArgParse.hs @@ -225,7 +225,7 @@ transcriptCommand = transcriptHelp = "Execute transcript markdown files" transcriptFooter = Just . fold . List.intersperse P.line $ - [ "For each .md file provided this executes the transcript and creates" <+> bold ".output.md" <+> "if successful.", + [ "For each .md file provided this executes the transcript and creates" <+> P.annotate bold ".output.md" <+> "if successful.", "Exits after completion, and deletes the temporary directory created, unless --save-codebase is provided", "Multiple transcript files may be provided; they are processed in sequence" <+> "starting from the same codebase." ] @@ -237,7 +237,7 @@ transcriptForkCommand = transcriptHelp = "Execute transcript markdown files in a sandboxed codebase" transcriptFooter = Just . fold . List.intersperse P.line $ - [ "For each .md file provided this executes the transcript in a sandbox codebase and creates" <+> bold ".output.md" <+> "if successful.", + [ "For each .md file provided this executes the transcript in a sandbox codebase and creates" <+> P.annotate bold ".output.md" <+> "if successful.", "Exits after completion, and deletes the temporary directory created, unless --save-codebase is provided", "Multiple transcript files may be provided; they are processed in sequence" <+> "starting from the same codebase." ] @@ -521,15 +521,15 @@ transcriptForkParser = do ) unisonHelp :: String -> String -> P.Doc -unisonHelp (P.text -> executable) (P.text -> version) = +unisonHelp (fromString -> executable) (fromString -> version) = fold . List.intersperse P.line $ - [ P.empty, + [ mempty, "🌻", - P.empty, - P.bold "Usage instructions for the Unison Codebase Manager", + mempty, + P.annotate P.bold "Usage instructions for the Unison Codebase Manager", "You are running version:" <+> version, - P.empty, - "To get started just run" <+> P.bold executable, - P.empty, - "Use" <+> P.bold (executable <+> "[command] --help") <+> "to show help for a command." + mempty, + "To get started just run" <+> P.annotate P.bold executable, + mempty, + "Use" <+> P.annotate P.bold (executable <+> "[command] --help") <+> "to show help for a command." ] diff --git a/unison-cli/src/Unison/Cli/MonadUtils.hs b/unison-cli/src/Unison/Cli/MonadUtils.hs index 25034b4b45..f9aaf22237 100644 --- a/unison-cli/src/Unison/Cli/MonadUtils.hs +++ b/unison-cli/src/Unison/Cli/MonadUtils.hs @@ -113,7 +113,7 @@ import Unison.Codebase.ProjectPath qualified as PP import Unison.Codebase.ShortCausalHash (ShortCausalHash) import Unison.Codebase.ShortCausalHash qualified as SCH import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name qualified as Name import Unison.NameSegment qualified as NameSegment import Unison.Names (Names) diff --git a/unison-cli/src/Unison/Cli/Pretty.hs b/unison-cli/src/Unison/Cli/Pretty.hs index 96ec98d48f..07a67d1c63 100644 --- a/unison-cli/src/Unison/Cli/Pretty.hs +++ b/unison-cli/src/Unison/Cli/Pretty.hs @@ -89,7 +89,7 @@ import Unison.Hash qualified as Hash import Unison.Hash32 (Hash32) import Unison.Hash32 qualified as Hash32 import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency as LD import Unison.Name (Name) import Unison.Name qualified as Name @@ -106,7 +106,7 @@ import Unison.Reference (Reference, TermReferenceId) import Unison.Reference qualified as Reference import Unison.Referent (Referent) import Unison.Referent qualified as Referent -import Unison.Server.SearchResult' qualified as SR' +import Unison.Server.SearchResultPrime qualified as SR' import Unison.ShortHash (ShortHash) import Unison.Symbol (Symbol) import Unison.Sync.Types qualified as Share diff --git a/unison-cli/src/Unison/Cli/Share/Projects.hs b/unison-cli/src/Unison/Cli/Share/Projects.hs index 961ed69858..52fbc56e8e 100644 --- a/unison-cli/src/Unison/Cli/Share/Projects.hs +++ b/unison-cli/src/Unison/Cli/Share/Projects.hs @@ -258,8 +258,10 @@ servantClientToCli action = do (mkClientEnv httpManager hardCodedBaseUrl) { Servant.makeClientRequest = \url request -> (Servant.defaultMakeClientRequest url request) - { Http.Client.responseTimeout = Http.Client.responseTimeoutMicro (60 * 1000 * 1000 {- 60s -}) - } + <&> \req -> + req + { Http.Client.responseTimeout = Http.Client.responseTimeoutMicro (60 * 1000 * 1000 {- 60s -}) + } } liftIO (runClientM action clientEnv) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index fe04d2cf0f..7f830ec2d7 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -117,7 +117,7 @@ import Unison.CommandLine.InputPatterns qualified as InputPatterns import Unison.ConstructorReference (GConstructorReference (..)) import Unison.DataDeclaration qualified as DD import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.LabeledDependency qualified as LD import Unison.LabeledDependency qualified as LabeledDependency diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/FindAndReplace.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/FindAndReplace.hs index 45fb100a44..6a46205240 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/FindAndReplace.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/FindAndReplace.hs @@ -20,7 +20,7 @@ import Unison.Codebase.Branch.Names qualified as Branch import Unison.Codebase.Editor.Output import Unison.Codebase.Editor.StructuredArgument qualified as SA import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment qualified as NameSegment diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs index ea319b74af..176a781bfa 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs @@ -80,7 +80,7 @@ import Unison.Debug qualified as Debug import Unison.Hash (Hash) import Unison.Hash qualified as Hash import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Merge.CombineDiffs (CombinedDiffOp (..), combineDiffs) import Unison.Merge.Database (MergeDatabase (..), makeMergeDatabase, referent2to1) import Unison.Merge.DeclCoherencyCheck (IncoherentDeclReason (..), checkDeclCoherency, lenientCheckDeclCoherency) @@ -120,7 +120,7 @@ import Unison.Project (ProjectAndBranch (..), ProjectBranchName, ProjectBranchNa import Unison.Reference qualified as Reference import Unison.Referent (Referent) import Unison.Referent qualified as Referent -import Unison.Referent' qualified as Referent' +import Unison.ReferentPrime qualified as Referent' import Unison.Sqlite (Transaction) import Unison.Sqlite qualified as Sqlite import Unison.Syntax.DeclPrinter (AccessorName) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveAll.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveAll.hs index f8068a67f2..d7b926e8fe 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveAll.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveAll.hs @@ -8,7 +8,7 @@ import Unison.Codebase.Editor.HandleInput.MoveTerm (moveTermSteps) import Unison.Codebase.Editor.HandleInput.MoveType (moveTypeSteps) import Unison.Codebase.Editor.Output qualified as Output import Unison.Codebase.Path qualified as Path -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Prelude handleMoveAll :: Bool -> Path.Path' -> Path.Path' -> Text -> Cli () diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveTerm.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveTerm.hs index 5dd0bc2cc2..e8dbde0229 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveTerm.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveTerm.hs @@ -12,7 +12,7 @@ import Unison.Codebase.Editor.Output qualified as Output import Unison.Codebase.Path (Path') import Unison.Codebase.Path qualified as Path import Unison.Codebase.ProjectPath qualified as PP -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.NameSegment (NameSegment) import Unison.Prelude diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveType.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveType.hs index 286cdb91c8..9c6125c205 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveType.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MoveType.hs @@ -12,7 +12,7 @@ import Unison.Codebase.Editor.Output qualified as Output import Unison.Codebase.Path (Path') import Unison.Codebase.Path qualified as Path import Unison.Codebase.ProjectPath qualified as PP -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.NameSegment (NameSegment) import Unison.Prelude diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Upgrade.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Upgrade.hs index 454e530f17..af57ea6fab 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Upgrade.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Upgrade.hs @@ -35,7 +35,7 @@ import Unison.Codebase.Editor.HandleInput.Update2 import Unison.Codebase.Editor.Output qualified as Output import Unison.Codebase.Path qualified as Path import Unison.Codebase.ProjectPath qualified as PP -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment (NameSegment) diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index d7a3b06e81..c4358247e5 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -55,7 +55,7 @@ import Unison.DataDeclaration qualified as DD import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Hash (Hash) import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.Merge.DeclCoherencyCheck (IncoherentDeclReasons (..)) import Unison.Name (Name) @@ -74,7 +74,7 @@ import Unison.Reference (Reference, TermReference, TermReferenceId, TypeReferenc import Unison.Reference qualified as Reference import Unison.Referent (Referent) import Unison.Server.Backend (ShallowListEntry (..)) -import Unison.Server.SearchResult' (SearchResult') +import Unison.Server.SearchResultPrime (SearchResult') import Unison.Share.Sync.Types qualified as Sync import Unison.ShortHash (ShortHash) import Unison.Symbol (Symbol) diff --git a/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs b/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs index 27fff49aea..47f5952d37 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs @@ -10,7 +10,7 @@ import Unison.Codebase.BranchDiff (BranchDiff (BranchDiff)) import Unison.Codebase.BranchDiff qualified as BranchDiff import Unison.Codebase.Patch qualified as P import Unison.DataDeclaration (DeclOrBuiltin) -import Unison.HashQualified' (HashQualified) +import Unison.HashQualifiedPrime (HashQualified) import Unison.Name (Name) import Unison.Name qualified as Name import Unison.Names (Names) diff --git a/unison-cli/src/Unison/Codebase/Editor/Slurp.hs b/unison-cli/src/Unison/Codebase/Editor/Slurp.hs index 3c7e9e5239..df5f4beb60 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Slurp.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Slurp.hs @@ -21,7 +21,7 @@ import Unison.Parser.Ann (Ann) import Unison.Prelude import Unison.Referent (Referent) import Unison.Referent qualified as Referent -import Unison.Referent' qualified as Referent +import Unison.ReferentPrime qualified as Referent import Unison.Symbol (Symbol) import Unison.Syntax.Name qualified as Name (toText, unsafeParseVar) import Unison.UnisonFile qualified as UF diff --git a/unison-cli/src/Unison/Codebase/Editor/StructuredArgument.hs b/unison-cli/src/Unison/Codebase/Editor/StructuredArgument.hs index 33dbddf9b8..21ee27c637 100644 --- a/unison-cli/src/Unison/Codebase/Editor/StructuredArgument.hs +++ b/unison-cli/src/Unison/Codebase/Editor/StructuredArgument.hs @@ -6,7 +6,7 @@ import Unison.Codebase.Editor.Input import Unison.Codebase.Path (Path') import Unison.Codebase.Path qualified as Path import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Parser.Ann (Ann) import Unison.Project (ProjectAndBranch, ProjectBranchName, ProjectName) diff --git a/unison-cli/src/Unison/Codebase/Watch.hs b/unison-cli/src/Unison/Codebase/Watch.hs index 54838c7a86..c587d6ece5 100644 --- a/unison-cli/src/Unison/Codebase/Watch.hs +++ b/unison-cli/src/Unison/Codebase/Watch.hs @@ -44,8 +44,8 @@ watchDirectory' d = do mvar <- newEmptyMVar let handler :: Event -> IO () handler e = case e of - Added fp t False -> doIt fp t - Modified fp t False -> doIt fp t + Added fp t FSNotify.IsFile -> doIt fp t + Modified fp t FSNotify.IsFile -> doIt fp t _ -> pure () where doIt fp t = do @@ -56,7 +56,7 @@ watchDirectory' d = do cleanupRef <- newEmptyMVar -- we don't like FSNotify's debouncing (it seems to drop later events) -- so we will be doing our own instead - let config = FSNotify.defaultConfig {FSNotify.confDebounce = FSNotify.NoDebounce} + let config = FSNotify.defaultConfig cancel <- liftIO $ forkIO $ FSNotify.withManagerConf config $ \mgr -> do diff --git a/unison-cli/src/Unison/CommandLine/Completion.hs b/unison-cli/src/Unison/CommandLine/Completion.hs index a317c004e5..10a838373e 100644 --- a/unison-cli/src/Unison/CommandLine/Completion.hs +++ b/unison-cli/src/Unison/CommandLine/Completion.hs @@ -50,7 +50,7 @@ import Unison.Codebase.Path.Parse qualified as Path import Unison.Codebase.ProjectPath qualified as PP import Unison.Codebase.SqliteCodebase.Conversions qualified as Cv import Unison.CommandLine.InputPattern qualified as IP -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name qualified as Name import Unison.NameSegment.Internal (NameSegment (NameSegment)) import Unison.Prelude diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index e17abc061a..159dac83a7 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -200,7 +200,7 @@ import Unison.CommandLine.InputPattern (ArgumentType (..), InputPattern (InputPa import Unison.CommandLine.InputPattern qualified as I import Unison.Core.Project (ProjectBranchName (..)) import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment (NameSegment) diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 9ff7158fed..473e3d01c6 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -83,7 +83,7 @@ import Unison.DataDeclaration qualified as DD import Unison.Hash qualified as Hash import Unison.Hash32 (Hash32) import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency as LD import Unison.Merge.DeclCoherencyCheck (IncoherentDeclReasons (..)) import Unison.Name (Name) @@ -113,11 +113,11 @@ import Unison.Reference (Reference) import Unison.Reference qualified as Reference import Unison.Referent (Referent) import Unison.Referent qualified as Referent -import Unison.Referent' qualified as Referent +import Unison.ReferentPrime qualified as Referent import Unison.Result qualified as Result import Unison.Server.Backend (ShallowListEntry (..), TypeEntry (..)) import Unison.Server.Backend qualified as Backend -import Unison.Server.SearchResult' qualified as SR' +import Unison.Server.SearchResultPrime qualified as SR' import Unison.Share.Sync qualified as Share import Unison.Share.Sync.Types (CodeserverTransportError (..)) import Unison.Sync.Types qualified as Share diff --git a/unison-cli/src/Unison/LSP.hs b/unison-cli/src/Unison/LSP.hs index 7163880956..7ec47063b1 100644 --- a/unison-cli/src/Unison/LSP.hs +++ b/unison-cli/src/Unison/LSP.hs @@ -85,8 +85,8 @@ spawnLsp lspFormattingConfig codebase runtime signal = -- currently we have an independent VFS for each LSP client since each client might have -- different un-saved state for the same file. - initVFS $ \vfs -> do - vfsVar <- newMVar vfs + do + vfsVar <- newMVar emptyVFS void $ runServerWith lspServerLogger lspClientLogger clientInput clientOutput (serverDefinition lspFormattingConfig vfsVar codebase runtime scope signal) where handleFailure :: String -> IOException -> IO () diff --git a/unison-cli/src/Unison/LSP/Completion.hs b/unison-cli/src/Unison/LSP/Completion.hs index 89a375eee6..d822c62be2 100644 --- a/unison-cli/src/Unison/LSP/Completion.hs +++ b/unison-cli/src/Unison/LSP/Completion.hs @@ -31,7 +31,7 @@ import Text.Megaparsec qualified as Megaparsec import Unison.Codebase.Path (Path) import Unison.Codebase.Path qualified as Path import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LSP.FileAnalysis import Unison.LSP.Queries qualified as LSPQ import Unison.LSP.Types @@ -51,7 +51,7 @@ import Unison.Reference qualified as Reference import Unison.Referent qualified as Referent import Unison.Runtime.IOSource qualified as IOSource import Unison.Syntax.DeclPrinter qualified as DeclPrinter -import Unison.Syntax.HashQualified' qualified as HQ' (toText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (toText) import Unison.Syntax.Name qualified as Name (nameP, parseText, toText) import Unison.Syntax.TypePrinter qualified as TypePrinter import Unison.Util.Monoid qualified as Monoid diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 221e8957f1..7a7ae006cf 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -56,7 +56,7 @@ import Unison.Referent qualified as Referent import Unison.Result (Note) import Unison.Result qualified as Result import Unison.Symbol (Symbol) -import Unison.Syntax.HashQualified' qualified as HQ' (toText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (toText) import Unison.Syntax.Lexer qualified as L import Unison.Syntax.Name qualified as Name import Unison.Syntax.Parser qualified as Parser diff --git a/unison-cli/src/Unison/Share/Sync.hs b/unison-cli/src/Unison/Share/Sync.hs index 6ccf8939ef..aa08d01875 100644 --- a/unison-cli/src/Unison/Share/Sync.hs +++ b/unison-cli/src/Unison/Share/Sync.hs @@ -733,8 +733,10 @@ httpUploadEntities :: { Servant.makeClientRequest = \url request -> -- Disable client-side timeouts (Servant.defaultMakeClientRequest url request) - { Http.Client.responseTimeout = Http.Client.responseTimeoutNone - } + <&> \r -> + r + { Http.Client.responseTimeout = Http.Client.responseTimeoutNone + } } & runReaderT (f req) & runExceptT diff --git a/unison-core/src/Unison/DataDeclaration.hs b/unison-core/src/Unison/DataDeclaration.hs index b6c9776dc7..513759ac07 100644 --- a/unison-core/src/Unison/DataDeclaration.hs +++ b/unison-core/src/Unison/DataDeclaration.hs @@ -52,7 +52,7 @@ import Unison.Prelude import Unison.Reference (Reference) import Unison.Reference qualified as Reference import Unison.Referent qualified as Referent -import Unison.Referent' qualified as Referent' +import Unison.ReferentPrime qualified as Referent' import Unison.Type (Type) import Unison.Type qualified as Type import Unison.Var (Var) diff --git a/unison-core/src/Unison/HashQualified'.hs b/unison-core/src/Unison/HashQualifiedPrime.hs similarity index 99% rename from unison-core/src/Unison/HashQualified'.hs rename to unison-core/src/Unison/HashQualifiedPrime.hs index b1ea8c1deb..19c341f4d6 100644 --- a/unison-core/src/Unison/HashQualified'.hs +++ b/unison-core/src/Unison/HashQualifiedPrime.hs @@ -1,4 +1,4 @@ -module Unison.HashQualified' where +module Unison.HashQualifiedPrime where import Data.Text qualified as Text import Unison.HashQualified qualified as HQ diff --git a/unison-core/src/Unison/Names.hs b/unison-core/src/Unison/Names.hs index 1897ac1178..7080122c04 100644 --- a/unison-core/src/Unison/Names.hs +++ b/unison-core/src/Unison/Names.hs @@ -62,7 +62,7 @@ import Text.FuzzyFind qualified as FZF import Unison.ConstructorReference (GConstructorReference (..)) import Unison.ConstructorType qualified as CT import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.LabeledDependency qualified as LD import Unison.Name (Name) diff --git a/unison-core/src/Unison/NamesWithHistory.hs b/unison-core/src/Unison/NamesWithHistory.hs index 7e2d126ec4..561fa557f8 100644 --- a/unison-core/src/Unison/NamesWithHistory.hs +++ b/unison-core/src/Unison/NamesWithHistory.hs @@ -34,7 +34,7 @@ import Unison.ConstructorReference (ConstructorReference) import Unison.ConstructorType qualified as CT import Unison.HashQualified (HashQualified) import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.Names (Names (..)) diff --git a/unison-core/src/Unison/Referent.hs b/unison-core/src/Unison/Referent.hs index d04454ea17..104a88e6f0 100644 --- a/unison-core/src/Unison/Referent.hs +++ b/unison-core/src/Unison/Referent.hs @@ -41,7 +41,7 @@ import Unison.Prelude hiding (fold) import Unison.Reference (Reference, TermReference, TermReferenceId) import Unison.Reference qualified as R import Unison.Reference qualified as Reference -import Unison.Referent' (Referent' (..), reference_, toReference') +import Unison.ReferentPrime (Referent' (..), reference_, toReference') import Unison.ShortHash (ShortHash) import Unison.ShortHash qualified as SH diff --git a/unison-core/src/Unison/Referent'.hs b/unison-core/src/Unison/ReferentPrime.hs similarity index 96% rename from unison-core/src/Unison/Referent'.hs rename to unison-core/src/Unison/ReferentPrime.hs index b65b75e09d..a51aff374f 100644 --- a/unison-core/src/Unison/Referent'.hs +++ b/unison-core/src/Unison/ReferentPrime.hs @@ -1,12 +1,12 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-} -module Unison.Referent' +module Unison.ReferentPrime ( Referent' (..), -- * Basic queries isConstructor, - Unison.Referent'.fold, + Unison.ReferentPrime.fold, -- * Lenses reference_, diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index bde4b2a6f7..51f20e271a 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -34,7 +34,7 @@ library Unison.DataDeclaration.Records Unison.Hashable Unison.HashQualified - Unison.HashQualified' + Unison.HashQualifiedPrime Unison.Kind Unison.LabeledDependency Unison.Name @@ -48,7 +48,7 @@ library Unison.Project Unison.Reference Unison.Referent - Unison.Referent' + Unison.ReferentPrime Unison.Settings Unison.Symbol Unison.Term diff --git a/unison-merge/src/Unison/Merge/Diff.hs b/unison-merge/src/Unison/Merge/Diff.hs index 1ad67238a4..492687e29a 100644 --- a/unison-merge/src/Unison/Merge/Diff.hs +++ b/unison-merge/src/Unison/Merge/Diff.hs @@ -13,7 +13,7 @@ import Unison.ConstructorReference (GConstructorReference (..)) import Unison.DataDeclaration (Decl) import Unison.DataDeclaration qualified as DataDeclaration import Unison.Hash (Hash (Hash)) -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Merge.Database (MergeDatabase (..)) import Unison.Merge.DeclNameLookup (DeclNameLookup) import Unison.Merge.DeclNameLookup qualified as DeclNameLookup diff --git a/unison-share-api/package.yaml b/unison-share-api/package.yaml index 6bea13f3dc..132a623041 100644 --- a/unison-share-api/package.yaml +++ b/unison-share-api/package.yaml @@ -9,7 +9,6 @@ library: other-modules: Paths_unison_share_api dependencies: - - NanoID - aeson >= 2.0.0.0 - async - base @@ -17,6 +16,7 @@ dependencies: - bytes - bytestring - containers + - cryptonite - Diff - directory - errors diff --git a/unison-share-api/src/Unison/Server/Backend.hs b/unison-share-api/src/Unison/Server/Backend.hs index b3535aeb23..5ca0c1f155 100644 --- a/unison-share-api/src/Unison/Server/Backend.hs +++ b/unison-share-api/src/Unison/Server/Backend.hs @@ -125,7 +125,7 @@ import Unison.ConstructorType qualified as CT import Unison.DataDeclaration qualified as DD import Unison.DataDeclaration.Dependencies qualified as DD import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Hashing.V2.Convert qualified as Hashing import Unison.LabeledDependency qualified as LD import Unison.Name (Name) @@ -155,7 +155,7 @@ import Unison.Server.NameSearch (NameSearch (..), Search (..), applySearch) import Unison.Server.NameSearch.Sqlite (termReferentsByShortHash, typeReferencesByShortHash) import Unison.Server.QueryResult import Unison.Server.SearchResult qualified as SR -import Unison.Server.SearchResult' qualified as SR' +import Unison.Server.SearchResultPrime qualified as SR' import Unison.Server.Syntax qualified as Syntax import Unison.Server.Types import Unison.Server.Types qualified as ServerTypes @@ -164,7 +164,7 @@ import Unison.ShortHash qualified as SH import Unison.Sqlite qualified as Sqlite import Unison.Symbol (Symbol) import Unison.Syntax.DeclPrinter qualified as DeclPrinter -import Unison.Syntax.HashQualified' qualified as HQ' (toText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (toText) import Unison.Syntax.Name as Name (toText, unsafeParseText) import Unison.Syntax.NamePrinter qualified as NP import Unison.Syntax.NameSegment qualified as NameSegment (toEscapedText) diff --git a/unison-share-api/src/Unison/Server/CodebaseServer.hs b/unison-share-api/src/Unison/Server/CodebaseServer.hs index fbb09b2310..1bbdfa5e24 100644 --- a/unison-share-api/src/Unison/Server/CodebaseServer.hs +++ b/unison-share-api/src/Unison/Server/CodebaseServer.hs @@ -10,13 +10,14 @@ import Control.Concurrent.Async (race) import Control.Exception (ErrorCall (..), throwIO) import Control.Monad.Reader import Control.Monad.Trans.Except +import Crypto.Random qualified as Crypto import Data.Aeson () +import Data.ByteArray.Encoding qualified as BE import Data.ByteString qualified as Strict import Data.ByteString.Char8 (unpack) import Data.ByteString.Char8 qualified as C8 import Data.ByteString.Lazy qualified as Lazy import Data.ByteString.Lazy.UTF8 qualified as BLU -import Data.NanoID (customNanoID, defaultAlphabet, unNanoID) import Data.OpenApi (Info (..), License (..), OpenApi, URL (..)) import Data.OpenApi.Lens qualified as OpenApi import Data.Proxy (Proxy (..)) @@ -83,7 +84,6 @@ import System.Directory (canonicalizePath, doesFileExist) import System.Environment (getExecutablePath) import System.FilePath (()) import System.FilePath qualified as FilePath -import System.Random.MWC (createSystemRandom) import U.Codebase.Branch qualified as V2 import U.Codebase.Causal qualified as Causal import U.Codebase.HashTags (CausalHash) @@ -400,11 +400,18 @@ app env rt codebase uiPath expectedToken allowCorsHost = -- | The Token is used to help prevent multiple users on a machine gain access to -- each others codebases. +-- +-- Generate a cryptographically secure random token. +-- https://neilmadden.blog/2018/08/30/moving-away-from-uuids/ +-- +-- E.g. +-- >>> genToken +-- "uxf85C7Y0B6om47" genToken :: IO Strict.ByteString genToken = do - g <- createSystemRandom - n <- customNanoID defaultAlphabet 16 g - pure $ unNanoID n + BE.convertToBase @ByteString BE.Base64URLUnpadded <$> Crypto.getRandomBytes numRandomBytes + where + numRandomBytes = 10 data Waiter a = Waiter { notify :: a -> IO (), diff --git a/unison-share-api/src/Unison/Server/Local/Definitions.hs b/unison-share-api/src/Unison/Server/Local/Definitions.hs index 9c014a965f..11a2623154 100644 --- a/unison-share-api/src/Unison/Server/Local/Definitions.hs +++ b/unison-share-api/src/Unison/Server/Local/Definitions.hs @@ -20,7 +20,7 @@ import Unison.Codebase.Path (Path) import Unison.Codebase.Runtime qualified as Rt import Unison.DataDeclaration qualified as DD import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.NamesWithHistory qualified as NS import Unison.NamesWithHistory qualified as Names diff --git a/unison-share-api/src/Unison/Server/NameSearch.hs b/unison-share-api/src/Unison/Server/NameSearch.hs index 2336d3241b..5e61cd8c30 100644 --- a/unison-share-api/src/Unison/Server/NameSearch.hs +++ b/unison-share-api/src/Unison/Server/NameSearch.hs @@ -12,7 +12,7 @@ import Control.Lens import Data.List qualified as List import Data.Set qualified as Set import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.NamesWithHistory (SearchType (..)) import Unison.Prelude diff --git a/unison-share-api/src/Unison/Server/NameSearch/FromNames.hs b/unison-share-api/src/Unison/Server/NameSearch/FromNames.hs index a78fc6f6f8..40a4ad4d29 100644 --- a/unison-share-api/src/Unison/Server/NameSearch/FromNames.hs +++ b/unison-share-api/src/Unison/Server/NameSearch/FromNames.hs @@ -1,6 +1,6 @@ module Unison.Server.NameSearch.FromNames where -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Names (Names) import Unison.NamesWithHistory qualified as Names import Unison.Reference (Reference) diff --git a/unison-share-api/src/Unison/Server/NameSearch/Sqlite.hs b/unison-share-api/src/Unison/Server/NameSearch/Sqlite.hs index 527c8bd634..8095d5bdce 100644 --- a/unison-share-api/src/Unison/Server/NameSearch/Sqlite.hs +++ b/unison-share-api/src/Unison/Server/NameSearch/Sqlite.hs @@ -17,7 +17,7 @@ import Unison.Codebase (Codebase) import Unison.Codebase qualified as Codebase import Unison.Codebase.Path qualified as Path import Unison.Codebase.SqliteCodebase.Conversions qualified as Cv -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency qualified as LD import Unison.Name (Name) import Unison.Name qualified as Name diff --git a/unison-share-api/src/Unison/Server/Orphans.hs b/unison-share-api/src/Unison/Server/Orphans.hs index 7451d2f183..bfe22d6716 100644 --- a/unison-share-api/src/Unison/Server/Orphans.hs +++ b/unison-share-api/src/Unison/Server/Orphans.hs @@ -26,7 +26,7 @@ import Unison.Core.Project (ProjectBranchName (..), ProjectName (..)) import Unison.Hash (Hash (..)) import Unison.Hash qualified as Hash import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.NameSegment.Internal (NameSegment (NameSegment)) @@ -37,7 +37,7 @@ import Unison.Referent qualified as Referent import Unison.ShortHash (ShortHash) import Unison.ShortHash qualified as SH import Unison.Syntax.HashQualified qualified as HQ (parseText) -import Unison.Syntax.HashQualified' qualified as HQ' (parseText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (parseText) import Unison.Syntax.Name qualified as Name (parseTextEither, toText) import Unison.Syntax.NameSegment qualified as NameSegment import Unison.Util.Pretty (Width (..)) diff --git a/unison-share-api/src/Unison/Server/SearchResult.hs b/unison-share-api/src/Unison/Server/SearchResult.hs index c30c16634a..9dd8d09046 100644 --- a/unison-share-api/src/Unison/Server/SearchResult.hs +++ b/unison-share-api/src/Unison/Server/SearchResult.hs @@ -2,7 +2,7 @@ module Unison.Server.SearchResult where import Data.Set qualified as Set import Unison.HashQualified (HashQualified) -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.Names (Names (..)) diff --git a/unison-share-api/src/Unison/Server/SearchResult'.hs b/unison-share-api/src/Unison/Server/SearchResultPrime.hs similarity index 96% rename from unison-share-api/src/Unison/Server/SearchResult'.hs rename to unison-share-api/src/Unison/Server/SearchResultPrime.hs index d928811ed5..b24c9f2c8a 100644 --- a/unison-share-api/src/Unison/Server/SearchResult'.hs +++ b/unison-share-api/src/Unison/Server/SearchResultPrime.hs @@ -1,6 +1,6 @@ {-# LANGUAGE PatternSynonyms #-} -module Unison.Server.SearchResult' where +module Unison.Server.SearchResultPrime where import Data.Set qualified as Set import Unison.Codebase.Editor.DisplayObject (DisplayObject) @@ -8,7 +8,7 @@ import Unison.Codebase.Editor.DisplayObject qualified as DT import Unison.DataDeclaration (Decl) import Unison.DataDeclaration qualified as DD import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.LabeledDependency (LabeledDependency) import Unison.LabeledDependency qualified as LD import Unison.Name (Name) diff --git a/unison-share-api/src/Unison/Server/Types.hs b/unison-share-api/src/Unison/Server/Types.hs index 50ff77ee08..6139c395af 100644 --- a/unison-share-api/src/Unison/Server/Types.hs +++ b/unison-share-api/src/Unison/Server/Types.hs @@ -42,7 +42,7 @@ import Unison.Codebase.Path qualified as Path import Unison.Core.Project (ProjectBranchName) import Unison.Hash qualified as Hash import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Prelude import Unison.Project (ProjectAndBranch, ProjectName) diff --git a/unison-share-api/src/Unison/Util/Find.hs b/unison-share-api/src/Unison/Util/Find.hs index 22923d7b03..792d439b24 100644 --- a/unison-share-api/src/Unison/Util/Find.hs +++ b/unison-share-api/src/Unison/Util/Find.hs @@ -15,7 +15,7 @@ import Data.Text qualified as Text -- https://www.stackage.org/haddock/lts-13.9/regex-tdfa-1.2.3.1/Text-Regex-TDFA.html import Text.Regex.TDFA qualified as RE import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Name qualified as Name import Unison.Names (Names) diff --git a/unison-share-api/unison-share-api.cabal b/unison-share-api/unison-share-api.cabal index 3741a18615..e3878a9e7f 100644 --- a/unison-share-api/unison-share-api.cabal +++ b/unison-share-api/unison-share-api.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack @@ -41,7 +41,7 @@ library Unison.Server.Orphans Unison.Server.QueryResult Unison.Server.SearchResult - Unison.Server.SearchResult' + Unison.Server.SearchResultPrime Unison.Server.Syntax Unison.Server.Types Unison.Sync.API @@ -84,7 +84,6 @@ library ghc-options: -Wall build-depends: Diff - , NanoID , aeson >=2.0.0.0 , async , base @@ -92,6 +91,7 @@ library , bytes , bytestring , containers + , cryptonite , directory , errors , extra diff --git a/unison-share-projects-api/src/Unison/Share/API/Hash.hs b/unison-share-projects-api/src/Unison/Share/API/Hash.hs index 1d975300a2..dfa1d1f44c 100644 --- a/unison-share-projects-api/src/Unison/Share/API/Hash.hs +++ b/unison-share-projects-api/src/Unison/Share/API/Hash.hs @@ -1,4 +1,9 @@ {-# LANGUAGE RecordWildCards #-} +-- Manipulating JWT claims with addClaim etc. directly is deprecated, so we'll need to fix that eventually. +-- The new way appears to be to define custom types with JSON instances and use those to encode/decode the JWT; +-- see https://github.com/frasertweedale/hs-jose/issues/116 +-- https://github.com/unisonweb/unison/issues/5153 +{-# OPTIONS_GHC -Wno-deprecations #-} -- | Hash-related types in the Share API. module Unison.Share.API.Hash diff --git a/unison-src/transcripts-using-base/failure-tests.output.md b/unison-src/transcripts-using-base/failure-tests.output.md index 3a661894dd..0efdd87b38 100644 --- a/unison-src/transcripts-using-base/failure-tests.output.md +++ b/unison-src/transcripts-using-base/failure-tests.output.md @@ -50,7 +50,7 @@ scratch/main> io.test test1 Failure (typeLink IOFailure) - "Cannot decode byte '\\xee': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream" + "Cannot decode byte '\\xee': Data.Text.Encoding: Invalid UTF-8 stream" (Any ()) Stack trace: diff --git a/unison-src/transcripts-using-base/net.output.md b/unison-src/transcripts-using-base/net.output.md index 4d95488cbf..4ffc0528bc 100644 --- a/unison-src/transcripts-using-base/net.output.md +++ b/unison-src/transcripts-using-base/net.output.md @@ -30,26 +30,28 @@ This mapping of names to port numbers is maintained by the [nsswitch service](https://en.wikipedia.org/wiki/Name_Service_Switch), typically stored in `/etc/services` and queried with the `getent` tool: - # map number to name - $ getent services 22 - ssh 22/tcp - - # map name to number - $ getent services finger - finger 79/tcp - - # get a list of all known names - $ getent services | head - tcpmux 1/tcp - echo 7/tcp - echo 7/udp - discard 9/tcp sink null - discard 9/udp sink null - systat 11/tcp users - daytime 13/tcp - daytime 13/udp - netstat 15/tcp - qotd 17/tcp quote +``` +# map number to name +$ getent services 22 +ssh 22/tcp + +# map name to number +$ getent services finger +finger 79/tcp + +# get a list of all known names +$ getent services | head +tcpmux 1/tcp +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +``` Below shows different examples of how we might specify the server coordinates. diff --git a/unison-src/transcripts-using-base/utf8.output.md b/unison-src/transcripts-using-base/utf8.output.md index 15c15c027e..f5bf210754 100644 --- a/unison-src/transcripts-using-base/utf8.output.md +++ b/unison-src/transcripts-using-base/utf8.output.md @@ -138,6 +138,6 @@ greek_bytes = Bytes.fromList [206, 145, 206, 146, 206, 147, 206, 148, 206] 5 | > match fromUtf8.impl (drop 1 greek_bytes) with ⧩ - "Cannot decode byte '\\x91': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream" + "Cannot decode byte '\\x91': Data.Text.Encoding: Invalid UTF-8 stream" ``` diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 96b43c63a4..0e2114f88e 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -1,12 +1,14 @@ The `alias.many` command can be used to copy definitions from the current namespace into your curated one. The names that will be used in the target namespace are the names you specify, relative to the current namespace: - scratch/main> help alias.many - - alias.many (or copy) - `alias.many [relative2...] ` creates aliases `relative1`, `relative2`, ... - in the namespace `namespace`. - `alias.many foo.foo bar.bar .quux` creates aliases `.quux.foo.foo` and `.quux.bar.bar`. +``` +scratch/main> help alias.many + + alias.many (or copy) + `alias.many [relative2...] ` creates aliases `relative1`, `relative2`, ... + in the namespace `namespace`. + `alias.many foo.foo bar.bar .quux` creates aliases `.quux.foo.foo` and `.quux.bar.bar`. +``` Let's try it\! diff --git a/unison-src/transcripts/anf-tests.output.md b/unison-src/transcripts/anf-tests.output.md index 0a1242dda9..f58ad3bc0d 100644 --- a/unison-src/transcripts/anf-tests.output.md +++ b/unison-src/transcripts/anf-tests.output.md @@ -2,7 +2,9 @@ This tests a variable related bug in the ANF compiler. The nested let would get flattened out, resulting in: - bar = result +``` +bar = result +``` which would be handled by renaming. However, the *context* portion of the rest of the code was not being renamed correctly, so `bar` would diff --git a/unison-src/transcripts/fix2350.output.md b/unison-src/transcripts/fix2350.output.md index 5f6f273c32..cb0cf5de75 100644 --- a/unison-src/transcripts/fix2350.output.md +++ b/unison-src/transcripts/fix2350.output.md @@ -2,7 +2,9 @@ This tests an issue where ability variables were being defaulted over eagerly. In general, we want to avoid collecting up variables from the use of definitions with types like: - T ->{e} U +``` +T ->{e} U +``` Since this type works for every `e`, it is, 'pure;' and we might as well have `e = {}`, since `{}` is a subrow of every other row. @@ -11,7 +13,9 @@ ongoing inference, it's undesirable to default it. Previously there was a check to see if `e` occurred in the context. However, the wanted abilities being collected aren't in the context, so types like: - T ->{S e} U ->{e} V +``` +T ->{S e} U ->{e} V +``` were a corner case. We would add `S e` to the wanted abilities, then not realize that `e` shouldn't be defaulted. diff --git a/unison-src/transcripts/fix2474.output.md b/unison-src/transcripts/fix2474.output.md index d5863ee876..519f0d2b30 100644 --- a/unison-src/transcripts/fix2474.output.md +++ b/unison-src/transcripts/fix2474.output.md @@ -2,7 +2,9 @@ Tests an issue with a lack of generality of handlers. In general, a set of cases: - { e ... -> k } +``` +{ e ... -> k } +``` should be typed in the following way: diff --git a/unison-src/transcripts/fix2663.output.md b/unison-src/transcripts/fix2663.output.md index d1b0575e12..2e12426d9b 100644 --- a/unison-src/transcripts/fix2663.output.md +++ b/unison-src/transcripts/fix2663.output.md @@ -2,7 +2,9 @@ Tests a variable capture problem. After pattern compilation, the match would end up: - T p1 p3 p3 +``` +T p1 p3 p3 +``` and z would end up referring to the first p3 rather than the second. diff --git a/unison-src/transcripts/fix2840.output.md b/unison-src/transcripts/fix2840.output.md index d6e9c3eef0..020c4b1a4d 100644 --- a/unison-src/transcripts/fix2840.output.md +++ b/unison-src/transcripts/fix2840.output.md @@ -33,8 +33,10 @@ scratch/main> display README ``` Previously, the error was: - ⚙️ Processing stanza 5 of 7.ucm: PE [("die",SrcLoc {srcLocPackage = "unison-parser-typechecker-0.0.0-He2Hp1llokT2nN4MnUfUXz", srcLocModule = "Unison.Runtime.Interface", srcLocFile = "src/Unison/Runtime/Interface.hs", srcLocStartLine = 118, srcLocStartCol = 18, srcLocEndLine = 118, srcLocEndCol = 60})] Lit - AnnotatedText (fromList [Segment {segment = "Unknown term reference: #4522d", annotation = Nothing}]) +``` +⚙️ Processing stanza 5 of 7.ucm: PE [("die",SrcLoc {srcLocPackage = "unison-parser-typechecker-0.0.0-He2Hp1llokT2nN4MnUfUXz", srcLocModule = "Unison.Runtime.Interface", srcLocFile = "src/Unison/Runtime/Interface.hs", srcLocStartLine = 118, srcLocStartCol = 18, srcLocEndLine = 118, srcLocEndCol = 60})] Lit + AnnotatedText (fromList [Segment {segment = "Unknown term reference: #4522d", annotation = Nothing}]) +``` but as of this PR, it's okay. diff --git a/unison-src/transcripts/generic-parse-errors.output.md b/unison-src/transcripts/generic-parse-errors.output.md index c66d0c5948..6c5c5048b1 100644 --- a/unison-src/transcripts/generic-parse-errors.output.md +++ b/unison-src/transcripts/generic-parse-errors.output.md @@ -66,6 +66,24 @@ x = a.#abc I was surprised to find a '.' here. + I was expecting one of these instead: + + * and + * bang + * do + * false + * force + * handle + * if + * infixApp + * let + * newline or semicolon + * or + * quote + * termLink + * true + * tuple + * typeLink ``` ``` unison diff --git a/unison-src/transcripts/hello.output.md b/unison-src/transcripts/hello.output.md index 720cd6d3ff..b486a40213 100644 --- a/unison-src/transcripts/hello.output.md +++ b/unison-src/transcripts/hello.output.md @@ -4,7 +4,9 @@ This markdown file is also a Unison transcript file. Transcript files are an eas The format is just a regular markdown file with some fenced code blocks that are typechecked and elaborated by `ucm`. For example, you can call this transcript via: - $ ucm transcript hello.md +``` +$ ucm transcript hello.md +``` This runs it on a freshly generated empty codebase. Alternately `ucm transcript.fork --codebase /path/to/code hello.md` runs the transcript on a freshly generated copy of the provided codebase. Do `ucm help` to learn more about usage. diff --git a/unison-src/transcripts/input-parse-errors.output.md b/unison-src/transcripts/input-parse-errors.output.md index f349b8a889..4dc0dc8133 100644 --- a/unison-src/transcripts/input-parse-errors.output.md +++ b/unison-src/transcripts/input-parse-errors.output.md @@ -76,7 +76,9 @@ You can run `help update` for more information on using ``` aliasTerm - scratch/main> alias.term ##Nat.+ Nat.+ +``` +scratch/main> alias.term ##Nat.+ Nat.+ +``` aliasTermForce, aliasType, diff --git a/unison-src/transcripts/names.output.md b/unison-src/transcripts/names.output.md index c9b3389ecd..27b986afb0 100644 --- a/unison-src/transcripts/names.output.md +++ b/unison-src/transcripts/names.output.md @@ -85,10 +85,12 @@ scratch/main> names .some.place.x TODO: swap this back to a 'ucm' block when names.global is re-implemented - -- We can search from a different branch and find all names in the codebase named 'x', and each of their aliases respectively. - scratch/other> names.global x - -- We can search by hash, and see all aliases of that hash in the codebase - scratch/other> names.global #gjmq673r1v - -- We can search using an absolute name - scratch/other> names.global .some.place.x +``` +-- We can search from a different branch and find all names in the codebase named 'x', and each of their aliases respectively. +scratch/other> names.global x +-- We can search by hash, and see all aliases of that hash in the codebase +scratch/other> names.global #gjmq673r1v +-- We can search using an absolute name +scratch/other> names.global .some.place.x +``` diff --git a/unison-src/transcripts/view.output.md b/unison-src/transcripts/view.output.md index a4698d9d07..336a8c932e 100644 --- a/unison-src/transcripts/view.output.md +++ b/unison-src/transcripts/view.output.md @@ -24,8 +24,10 @@ scratch/main> view .b.thing ``` TODO: swap this back to a 'ucm' block when view.global is re-implemented - -- view.global should search globally and be absolutely qualified - scratch/other> view.global thing - -- Should support branch relative paths - scratch/other> view /main:a.thing +``` +-- view.global should search globally and be absolutely qualified +scratch/other> view.global thing +-- Should support branch relative paths +scratch/other> view /main:a.thing +``` diff --git a/unison-syntax/src/Unison/Syntax/HashQualified.hs b/unison-syntax/src/Unison/Syntax/HashQualified.hs index e90d8c6cb7..927f548805 100644 --- a/unison-syntax/src/Unison/Syntax/HashQualified.hs +++ b/unison-syntax/src/Unison/Syntax/HashQualified.hs @@ -21,10 +21,10 @@ import Text.Megaparsec qualified as P import Text.Megaparsec.Internal qualified as P (withParsecT) import Unison.HashQualified (HashQualified (..)) import Unison.HashQualified qualified as HashQualified -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Prelude hiding (fromString) -import Unison.Syntax.HashQualified' qualified as HQ' +import Unison.Syntax.HashQualifiedPrime qualified as HQ' import Unison.Syntax.Lexer.Token (Token) import Unison.Syntax.Name qualified as Name (nameP, toText) import Unison.Syntax.NameSegment qualified as NameSegment diff --git a/unison-syntax/src/Unison/Syntax/HashQualified'.hs b/unison-syntax/src/Unison/Syntax/HashQualifiedPrime.hs similarity index 95% rename from unison-syntax/src/Unison/Syntax/HashQualified'.hs rename to unison-syntax/src/Unison/Syntax/HashQualifiedPrime.hs index de5c4bfeab..6326006c7a 100644 --- a/unison-syntax/src/Unison/Syntax/HashQualified'.hs +++ b/unison-syntax/src/Unison/Syntax/HashQualifiedPrime.hs @@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -- | Syntax-related combinators for HashQualified' (to/from string types). -module Unison.Syntax.HashQualified' +module Unison.Syntax.HashQualifiedPrime ( -- * String conversions parseText, unsafeParseText, @@ -16,7 +16,7 @@ import Data.Text qualified as Text import Text.Megaparsec (ParsecT) import Text.Megaparsec qualified as P import Text.Megaparsec.Internal qualified as P (withParsecT) -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Name (Name) import Unison.Prelude hiding (fromString) import Unison.Syntax.Lexer.Token (Token) diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index 6a2d74911e..14fe31f9a7 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -44,7 +44,7 @@ import Text.Megaparsec.Char qualified as CP import Text.Megaparsec.Char.Lexer qualified as LP import Text.Megaparsec.Error qualified as EP import Text.Megaparsec.Internal qualified as PI -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Lexer.Pos (Column, Line, Pos (Pos), column, line) import Unison.Name (Name) import Unison.Name qualified as Name @@ -54,7 +54,7 @@ import Unison.NameSegment.Internal qualified as NameSegment import Unison.Prelude import Unison.ShortHash (ShortHash) import Unison.ShortHash qualified as SH -import Unison.Syntax.HashQualified' qualified as HQ' (toText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (toText) import Unison.Syntax.Lexer.Token (Token (..), posP, tokenP) import Unison.Syntax.Name qualified as Name (isSymboly, nameP, toText, unsafeParseText) import Unison.Syntax.NameSegment (symbolyIdChar, wordyIdChar, wordyIdStartChar) diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 9dee6337e9..015537c467 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -72,7 +72,7 @@ import Unison.ABT qualified as ABT import Unison.ConstructorReference (ConstructorReference) import Unison.Hash qualified as Hash import Unison.HashQualified qualified as HQ -import Unison.HashQualified' qualified as HQ' +import Unison.HashQualifiedPrime qualified as HQ' import Unison.Hashable qualified as Hashable import Unison.Name as Name import Unison.Names (Names) diff --git a/unison-syntax/test/Main.hs b/unison-syntax/test/Main.hs index 3b3319567d..bd40c7ded8 100644 --- a/unison-syntax/test/Main.hs +++ b/unison-syntax/test/Main.hs @@ -9,7 +9,7 @@ import System.IO.CodePage (withCP65001) import Unison.Prelude import Unison.ShortHash (ShortHash) import Unison.ShortHash qualified as ShortHash -import Unison.Syntax.HashQualified' qualified as HQ' (unsafeParseText) +import Unison.Syntax.HashQualifiedPrime qualified as HQ' (unsafeParseText) import Unison.Syntax.Lexer main :: IO () diff --git a/unison-syntax/unison-syntax.cabal b/unison-syntax/unison-syntax.cabal index 9c3241e394..888982134f 100644 --- a/unison-syntax/unison-syntax.cabal +++ b/unison-syntax/unison-syntax.cabal @@ -20,7 +20,7 @@ library Unison.Lexer.Pos Unison.Parser.Ann Unison.Syntax.HashQualified - Unison.Syntax.HashQualified' + Unison.Syntax.HashQualifiedPrime Unison.Syntax.Lexer Unison.Syntax.Lexer.Token Unison.Syntax.Name