From 7e63addad38c5bce07febe4146687a4b0b4f792e Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sat, 16 Mar 2024 13:20:12 +0100 Subject: chore(third_party/haskell): pa-label: 0.1.0.1 -> 0.1.1.0 chore(users/Profpatsch/whatcd-resolver): use more from Label New label version contains these helpers. Change-Id: I3ef2ae9b92f2c798842ae001588b2c6d9f3ab971 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11162 Tested-by: BuildkiteCI Autosubmit: Profpatsch Reviewed-by: Profpatsch --- third_party/overlays/haskell/default.nix | 2 +- .../haskell/extra-pkgs/pa-label-0.1.0.1.nix | 10 -------- .../overlays/haskell/extra-pkgs/pa-label.nix | 10 ++++++++ .../whatcd-resolver/src/WhatcdResolver.hs | 29 ---------------------- 4 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix create mode 100644 third_party/overlays/haskell/extra-pkgs/pa-label.nix diff --git a/third_party/overlays/haskell/default.nix b/third_party/overlays/haskell/default.nix index 5dbb8f45f8..eaf3d2e85c 100644 --- a/third_party/overlays/haskell/default.nix +++ b/third_party/overlays/haskell/default.nix @@ -29,7 +29,7 @@ in pa-prelude = hsSelf.callPackage ./extra-pkgs/pa-prelude.nix { }; pa-error-tree = hsSelf.callPackage ./extra-pkgs/pa-error-tree-0.1.0.0.nix { }; pa-field-parser = hsSelf.callPackage ./extra-pkgs/pa-field-parser.nix { }; - pa-label = hsSelf.callPackage ./extra-pkgs/pa-label-0.1.0.1.nix { }; + pa-label = hsSelf.callPackage ./extra-pkgs/pa-label.nix { }; pa-pretty = hsSelf.callPackage ./extra-pkgs/pa-pretty-0.1.1.0.nix { }; pa-json = hsSelf.callPackage ./extra-pkgs/pa-json.nix { }; pa-run-command = hsSelf.callPackage ./extra-pkgs/pa-run-command-0.1.0.0.nix { }; diff --git a/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix b/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix deleted file mode 100644 index 1da78260cc..0000000000 --- a/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ mkDerivation, base, lib }: -mkDerivation { - pname = "pa-label"; - version = "0.1.0.1"; - sha256 = "0131ab7718d910a94cd8cc881e51b7371a060dadfeabc8fd78513a7f27ee8d35"; - libraryHaskellDepends = [ base ]; - homepage = "https://github.com/possehl-analytics/pa-hackage"; - description = "Labels, and labelled tuples and enums (GHC >9.2)"; - license = lib.licenses.bsd3; -} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-label.nix b/third_party/overlays/haskell/extra-pkgs/pa-label.nix new file mode 100644 index 0000000000..7cfa257c81 --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-label.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib }: +mkDerivation { + pname = "pa-label"; + version = "0.1.1.0"; + sha256 = "b40183900c045641c0632ed8e53a326c0c0e9c2806568613c03b3131d9016183"; + libraryHaskellDepends = [ base ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Labels, and labelled tuples and enums (GHC >9.2)"; + license = lib.licenses.bsd3; +} diff --git a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs index 420861a203..6866d387cb 100644 --- a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs +++ b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs @@ -1272,35 +1272,6 @@ hush :: Either a1 a2 -> Maybe a2 hush (Left _) = Nothing hush (Right a) = Just a -zipT2 :: - forall l1 l2 t1 t2. - ( HasField l1 (T2 l1 [t1] l2 [t2]) [t1], - HasField l2 (T2 l1 [t1] l2 [t2]) [t2] - ) => - T2 l1 [t1] l2 [t2] -> - [T2 l1 t1 l2 t2] -zipT2 xs = - zipWith - (\t1 t2 -> T2 (label @l1 t1) (label @l2 t2)) - (getField @l1 xs) - (getField @l2 xs) - -unzipT2 :: forall l1 t1 l2 t2. [T2 l1 t1 l2 t2] -> T2 l1 [t1] l2 [t2] -unzipT2 xs = xs <&> toTup & unzip & fromTup - where - toTup :: forall a b. T2 a t1 b t2 -> (t1, t2) - toTup (T2 a b) = (getField @a a, getField @b b) - fromTup :: (a, b) -> T2 l1 a l2 b - fromTup (t1, t2) = T2 (label @l1 t1) (label @l2 t2) - -unzipT3 :: forall l1 t1 l2 t2 l3 t3. [T3 l1 t1 l2 t2 l3 t3] -> T3 l1 [t1] l2 [t2] l3 [t3] -unzipT3 xs = xs <&> toTup & unzip3 & fromTup - where - toTup :: forall a b c. T3 a t1 b t2 c t3 -> (t1, t2, t3) - toTup (T3 a b c) = (getField @a a, getField @b b, getField @c c) - fromTup :: (a, b, c) -> T3 l1 a l2 b l3 c - fromTup (t1, t2, t3) = T3 (label @l1 t1) (label @l2 t2) (label @l3 t3) - -- | Do a request to the redacted API. If you know what that is, you know how to find the API docs. mkRedactedApiRequest :: ( MonadThrow m, -- cgit 1.4.1