aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-13 19:52:46 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-13 19:52:46 +0200
commit4808710e311a69326c6fdef9fc1b9b2173fd009e (patch)
tree3bc1c5b71a7a3b1a2166a91cf886a078f0ddff67 /src/Data/Array
parent7501414935c8f24d5e132405dd897d46e240b692 (diff)
Less manual Foldable instances
Diffstat (limited to 'src/Data/Array')
-rw-r--r--src/Data/Array/Nested/Internal.hs20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs
index 4577967..18f458e 100644
--- a/src/Data/Array/Nested/Internal.hs
+++ b/src/Data/Array/Nested/Internal.hs
@@ -896,10 +896,7 @@ type role IxR nominal representational
type IxR :: INat -> Type -> Type
newtype IxR n i = IxR (ListR n i)
deriving (Show, Eq, Ord)
- deriving newtype (Functor)
-
-instance Foldable (IxR n) where
- foldr f z (IxR l) = foldr f z l
+ deriving newtype (Functor, Foldable)
pattern ZIR :: forall n i. () => n ~ Z => IxR n i
pattern ZIR = IxR ZR
@@ -928,10 +925,7 @@ type role ShR nominal representational
type ShR :: INat -> Type -> Type
newtype ShR n i = ShR (ListR n i)
deriving (Show, Eq, Ord)
- deriving newtype (Functor)
-
-instance Foldable (ShR n) where
- foldr f z (ShR l) = foldr f z l
+ deriving newtype (Functor, Foldable)
pattern ZSR :: forall n i. () => n ~ Z => ShR n i
pattern ZSR = ShR ZR
@@ -1115,10 +1109,7 @@ type role IxS nominal representational
type IxS :: [Nat] -> Type -> Type
newtype IxS sh i = IxS (ListS sh i)
deriving (Show, Eq, Ord)
- deriving newtype (Functor)
-
-instance Foldable (IxS sh) where
- foldr f z (IxS l) = foldr f z l
+ deriving newtype (Functor, Foldable)
pattern ZIS :: forall sh i. () => sh ~ '[] => IxS sh i
pattern ZIS = IxS ZS
@@ -1144,10 +1135,7 @@ type role ShS nominal representational
type ShS :: [Nat] -> Type -> Type
newtype ShS sh i = ShS (ListS sh i)
deriving (Show, Eq, Ord)
- deriving newtype (Functor)
-
-instance Foldable (ShS sh) where
- foldr f z (ShS l) = foldr f z l
+ deriving newtype (Functor, Foldable)
pattern ZSS :: forall sh i. () => sh ~ '[] => ShS sh i
pattern ZSS = ShS ZS