aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-13 19:29:22 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-13 19:29:22 +0200
commitd0772f3ee0d647de38cf0fdb13d2372837a9fefe (patch)
tree6a6ae1a78f923d38ceeb417c1fc7dd0fd36d88eb
parent4ca302cdb32e3d36152400962cc50d37d3d40494 (diff)
Rename StaticShape{R,S} to Sh{R,S}, because they encode runtime info
ShS is a borderline case, though
-rw-r--r--src/Data/Array/Nested.hs4
-rw-r--r--src/Data/Array/Nested/Internal.hs68
2 files changed, 36 insertions, 36 deletions
diff --git a/src/Data/Array/Nested.hs b/src/Data/Array/Nested.hs
index 9cb3182..389a8f5 100644
--- a/src/Data/Array/Nested.hs
+++ b/src/Data/Array/Nested.hs
@@ -5,7 +5,7 @@ module Data.Array.Nested (
Ranked,
ListR, pattern (:::), pattern ZR, knownListR,
IxR(..), pattern (:.:), pattern ZIR, IIxR, knownIxR,
- StaticShapeR(..), pattern (:$:), pattern ZSR, knownStaticShapeR,
+ ShR(..), pattern (:$:), pattern ZSR, knownShR,
rshape, rindex, rindexPartial, rgenerate, rsumOuter1,
rtranspose, rappend, rscalar, rfromVector, runScalar,
rconstant, rfromList, rfromList1, rtoList, rtoList1,
@@ -17,7 +17,7 @@ module Data.Array.Nested (
Shaped,
ListS, pattern (::$), pattern ZS,
IxS(..), pattern (:.$), pattern ZIS, IIxS,
- StaticShapeS(..), pattern (:$$), pattern ZSS,
+ ShS(..), pattern (:$$), pattern ZSS,
KnownShape(..), SShape(..),
sshape, sindex, sindexPartial, sgenerate, ssumOuter1,
stranspose, sappend, sscalar, sfromVector, sunScalar,
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs
index 594abd4..3f885e4 100644
--- a/src/Data/Array/Nested/Internal.hs
+++ b/src/Data/Array/Nested/Internal.hs
@@ -911,37 +911,37 @@ type IIxR n = IxR n Int
knownIxR :: IxR n i -> Dict KnownINat n
knownIxR (IxR sh) = knownListR sh
-type role StaticShapeR nominal representational
-type StaticShapeR :: INat -> Type -> Type
-newtype StaticShapeR n i = StaticShapeR (ListR n i)
+type role ShR nominal representational
+type ShR :: INat -> Type -> Type
+newtype ShR n i = ShR (ListR n i)
deriving (Show, Eq, Ord)
-deriving newtype instance Functor (StaticShapeR n)
+deriving newtype instance Functor (ShR n)
-instance Foldable (StaticShapeR n) where
- foldr f z (StaticShapeR l) = foldr f z l
+instance Foldable (ShR n) where
+ foldr f z (ShR l) = foldr f z l
-pattern ZSR :: forall n i. () => n ~ Z => StaticShapeR n i
-pattern ZSR = StaticShapeR ZR
+pattern ZSR :: forall n i. () => n ~ Z => ShR n i
+pattern ZSR = ShR ZR
pattern (:$:)
:: forall {n1} {i}.
forall n. ((S n) ~ n1)
- => i -> StaticShapeR n i -> StaticShapeR n1 i
-pattern i :$: sh <- (unconsStaticShapeR -> Just (UnconsStaticShapeRRes sh i))
- where i :$: (StaticShapeR sh) = StaticShapeR (i ::: sh)
+ => i -> ShR n i -> ShR n1 i
+pattern i :$: sh <- (unconsShR -> Just (UnconsShRRes sh i))
+ where i :$: (ShR sh) = ShR (i ::: sh)
{-# COMPLETE ZSR, (:$:) #-}
infixr 3 :$:
-data UnconsStaticShapeRRes i n1 =
- forall n. ((S n) ~ n1) => UnconsStaticShapeRRes (StaticShapeR n i) i
-unconsStaticShapeR :: StaticShapeR n1 i -> Maybe (UnconsStaticShapeRRes i n1)
-unconsStaticShapeR (StaticShapeR sh) = case sh of
- i ::: sh' -> Just (UnconsStaticShapeRRes (StaticShapeR sh') i)
+data UnconsShRRes i n1 =
+ forall n. ((S n) ~ n1) => UnconsShRRes (ShR n i) i
+unconsShR :: ShR n1 i -> Maybe (UnconsShRRes i n1)
+unconsShR (ShR sh) = case sh of
+ i ::: sh' -> Just (UnconsShRRes (ShR sh') i)
ZR -> Nothing
-knownStaticShapeR :: StaticShapeR n i -> Dict KnownINat n
-knownStaticShapeR (StaticShapeR sh) = knownListR sh
+knownShR :: ShR n i -> Dict KnownINat n
+knownShR (ShR sh) = knownListR sh
zeroIxR :: SINat n -> IIxR n
zeroIxR SZ = ZIR
@@ -1131,33 +1131,33 @@ unconsIxS (IxS shl) = case shl of
type IIxS sh = IxS sh Int
-type role StaticShapeS nominal representational
-type StaticShapeS :: [Nat] -> Type -> Type
-newtype StaticShapeS sh i = StaticShapeS (ListS sh i)
+type role ShS nominal representational
+type ShS :: [Nat] -> Type -> Type
+newtype ShS sh i = ShS (ListS sh i)
deriving (Show, Eq, Ord)
-deriving newtype instance Functor (StaticShapeS sh)
+deriving newtype instance Functor (ShS sh)
-instance Foldable (StaticShapeS sh) where
- foldr f z (StaticShapeS l) = foldr f z l
+instance Foldable (ShS sh) where
+ foldr f z (ShS l) = foldr f z l
-pattern ZSS :: forall sh i. () => sh ~ '[] => StaticShapeS sh i
-pattern ZSS = StaticShapeS ZS
+pattern ZSS :: forall sh i. () => sh ~ '[] => ShS sh i
+pattern ZSS = ShS ZS
pattern (:$$)
:: forall {sh1} {i}.
forall n sh. (n : sh ~ sh1)
- => i -> StaticShapeS sh i -> StaticShapeS sh1 i
-pattern i :$$ shl <- (unconsStaticShapeS -> Just (UnconsStaticShapeSRes shl i))
- where i :$$ (StaticShapeS shl) = StaticShapeS (i ::$ shl)
+ => i -> ShS sh i -> ShS sh1 i
+pattern i :$$ shl <- (unconsShS -> Just (UnconsShSRes shl i))
+ where i :$$ (ShS shl) = ShS (i ::$ shl)
{-# COMPLETE ZSS, (:$$) #-}
infixr 3 :$$
-data UnconsStaticShapeSRes i sh1 =
- forall n sh. (n : sh ~ sh1) => UnconsStaticShapeSRes (StaticShapeS sh i) i
-unconsStaticShapeS :: StaticShapeS sh1 i -> Maybe (UnconsStaticShapeSRes i sh1)
-unconsStaticShapeS (StaticShapeS shl) = case shl of
- i ::$ shl' -> Just (UnconsStaticShapeSRes (StaticShapeS shl') i)
+data UnconsShSRes i sh1 =
+ forall n sh. (n : sh ~ sh1) => UnconsShSRes (ShS sh i) i
+unconsShS :: ShS sh1 i -> Maybe (UnconsShSRes i sh1)
+unconsShS (ShS shl) = case shl of
+ i ::$ shl' -> Just (UnconsShSRes (ShS shl') i)
ZS -> Nothing
zeroIxS :: SShape sh -> IIxS sh