From 5a063def51c72611c98fa2aadaa4c938a12271fa Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 27 Dec 2022 14:32:52 +0100 Subject: chore(3p/sources): Bump channels & overlays The main change is that nixpkgs updated to GHC 9.2 and Stackage LTS-20, so we suffer from a bit of churn. * //3p/overlays/haskell: - use updated dhall-nix patch for hnix 0.16 - use superrecord fork with fixes for GHC 9.2 - use graphmod-1.4.5.1 which has support for GHC 9.2 * //users/Profpatsch: relax constraints on base in Haskell pkgs * //users/Profpatsch/cas-serve: inherit superrecord from 3p * //users/grfn/xanthous: - //3p/overlays/haskell for 8.10.7: * Provide missing dependency of binary-orphans. Fix already commited upstream as e238c3fdaab710a2ce0135e5a77cd7e6bb023a22, can be dropped when channel advances. * Downgrade to brick 0.71.1, the latest version xanthous supports. - Adjust to generic-arbitrary >= 1.0, providing Arg constraints where necessary. - Increase constraint-solver-iterations to 6 (default 4), so Xanthous.Command and Xanthous.Data can be typechecked. - Drop NFData instances for Key and Modifier which have been added to vty upstream. Change-Id: I2170438c2ce8130b65f1a9fe07c4fecab5683d66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7654 Autosubmit: sterni Reviewed-by: tazjin Reviewed-by: grfn Reviewed-by: Profpatsch Tested-by: BuildkiteCI --- users/grfn/xanthous/src/Xanthous/Data.hs | 13 +++++++++---- users/grfn/xanthous/src/Xanthous/Orphans.hs | 5 ++--- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'users/grfn/xanthous/src') diff --git a/users/grfn/xanthous/src/Xanthous/Data.hs b/users/grfn/xanthous/src/Xanthous/Data.hs index c11ceb55aa26..1acd14a0640b 100644 --- a/users/grfn/xanthous/src/Xanthous/Data.hs +++ b/users/grfn/xanthous/src/Xanthous/Data.hs @@ -191,7 +191,7 @@ y = lens (\(Position _ yy) -> yy) (\(Position xx _) yy -> Position xx yy) type Position = Position' Int -instance Arbitrary a => Arbitrary (Position' a) where +instance (Arg (Position' a) a, Arbitrary a) => Arbitrary (Position' a) where arbitrary = genericArbitrary shrink (Position px py) = Position <$> shrink px <*> shrink py @@ -313,7 +313,8 @@ data Direction where Here :: Direction deriving stock (Show, Eq, Ord, Generic) deriving anyclass (CoArbitrary, Function, NFData, ToJSON, FromJSON, Hashable) - deriving Arbitrary via GenericArbitrary Direction + +deriving via (GenericArbitrary Direction) instance Arbitrary Direction instance Opposite Direction where opposite Up = Down @@ -432,7 +433,8 @@ data Neighbors a = Neighbors } deriving stock (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) deriving anyclass (NFData, CoArbitrary, Function, MonoFoldable) - deriving Arbitrary via GenericArbitrary (Neighbors a) + +deriving via (GenericArbitrary (Neighbors a)) instance (Arg (Neighbors a) a, Arbitrary a) => Arbitrary (Neighbors a) type instance Element (Neighbors a) = a @@ -768,9 +770,12 @@ data Box a = Box , _dimensions :: V2 a } deriving stock (Show, Eq, Ord, Functor, Generic) - deriving Arbitrary via GenericArbitrary (Box a) makeFieldsNoPrefix ''Box +-- It seems to be necessary to have an `Arg (V2 a) a` constraint, as a is passed +-- to V2 internally, in order to make GHC figure out this deriving via correctly. +deriving via (GenericArbitrary (Box a)) instance (Arg (V2 a) a, Arbitrary a) => Arbitrary (Box a) + bottomRightCorner :: Num a => Box a -> V2 a bottomRightCorner box = V2 (box ^. topLeftCorner . L._x + box ^. dimensions . L._x) diff --git a/users/grfn/xanthous/src/Xanthous/Orphans.hs b/users/grfn/xanthous/src/Xanthous/Orphans.hs index 385873e7b464..b00c803cfe7a 100644 --- a/users/grfn/xanthous/src/Xanthous/Orphans.hs +++ b/users/grfn/xanthous/src/Xanthous/Orphans.hs @@ -22,6 +22,7 @@ import Brick.Widgets.Core (getName) import System.Random.Internal (StdGen (..)) import System.Random.SplitMix (SMGen ()) import Test.QuickCheck +import Test.QuickCheck.Arbitrary.Generic (Arg ()) import "quickcheck-instances" Test.QuickCheck.Instances () import Text.Megaparsec (errorBundlePretty) import Text.Megaparsec.Pos @@ -307,9 +308,7 @@ deriving stock instance Ord a => Ord (MaybeDefault a) deriving stock instance Ord Attr deriving anyclass instance Hashable Graphics.Vty.Input.Events.Key -deriving anyclass instance NFData Graphics.Vty.Input.Events.Key deriving anyclass instance Hashable Graphics.Vty.Input.Events.Modifier -deriving anyclass instance NFData Graphics.Vty.Input.Events.Modifier -------------------------------------------------------------------------------- @@ -374,7 +373,7 @@ deriving newtype instance (Arbitrary s, CoArbitrary (m (a, s))) -------------------------------------------------------------------------------- -deriving via (GenericArbitrary (V2 a)) instance Arbitrary a => Arbitrary (V2 a) +deriving via (GenericArbitrary (V2 a)) instance (Arg (V2 a) a, Arbitrary a) => Arbitrary (V2 a) instance CoArbitrary a => CoArbitrary (V2 a) instance Function a => Function (V2 a) -- cgit 1.4.1