aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Shaped
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-15 22:17:34 +0100
committerMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-15 22:17:34 +0100
commit6bbb1cd44fe60771b961889504c807a5c3953293 (patch)
tree3b275361d77272b8395a6498de92c5682bdba3cb /src/Data/Array/Nested/Shaped
parent5c85e5d5b6357ac3eb7a54ab6e7eccdc987004fa (diff)
Simplify the signature of fooIndex
Diffstat (limited to 'src/Data/Array/Nested/Shaped')
-rw-r--r--src/Data/Array/Nested/Shaped/Shape.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Data/Array/Nested/Shaped/Shape.hs b/src/Data/Array/Nested/Shaped/Shape.hs
index 7206be3..2a12cce 100644
--- a/src/Data/Array/Nested/Shaped/Shape.hs
+++ b/src/Data/Array/Nested/Shaped/Shape.hs
@@ -196,16 +196,16 @@ listsDropLenPerm (_ `PCons` _) ZS = error "Permutation longer than shape"
listsPermute :: forall f is sh. Perm is -> ListS sh f -> ListS (Permute is sh) f
listsPermute PNil _ = ZS
listsPermute (i `PCons` (is :: Perm is')) (sh :: ListS sh f) =
- case listsIndex (Proxy @is') (Proxy @sh) i sh of
+ case listsIndex i sh of
item -> item ::$ listsPermute is sh
-- TODO: try to remove this SNat now that the KnownNat constraint in ListS is removed
-listsIndex :: forall f i is sh shT. Proxy is -> Proxy shT -> SNat i -> ListS sh f -> f (Index i sh)
-listsIndex _ _ SZ (n ::$ _) = n
-listsIndex p pT (SS (i :: SNat i')) ((_ :: f n) ::$ (sh :: ListS sh' f))
+listsIndex :: forall f i sh. SNat i -> ListS sh f -> f (Index i sh)
+listsIndex SZ (n ::$ _) = n
+listsIndex (SS (i :: SNat i')) ((_ :: f n) ::$ (sh :: ListS sh' f))
| Refl <- lemIndexSucc (Proxy @i') (Proxy @n) (Proxy @sh')
- = listsIndex p pT i sh
-listsIndex _ _ _ ZS = error "Index into empty shape"
+ = listsIndex i sh
+listsIndex _ ZS = error "Index into empty shape"
listsPermutePrefix :: forall f is sh. Perm is -> ListS sh f -> ListS (PermutePrefix is sh) f
listsPermutePrefix perm sh = listsAppend (listsPermute perm (listsTakeLenPerm perm sh)) (listsDropLenPerm perm sh)
@@ -464,12 +464,11 @@ shsPermute =
:: Permute is (MapJust sh) :~: MapJust (Permute is sh)) $
coerce shxPermute
-shsIndex :: forall is shT i sh.
- Proxy is -> Proxy shT -> SNat i -> ShS sh -> SNat (Index i sh)
-shsIndex pis pshT i sh =
+shsIndex :: forall i sh. SNat i -> ShS sh -> SNat (Index i sh)
+shsIndex i sh =
gcastWith (unsafeCoerceRefl
:: Index i (MapJust sh) :~: Just (Index i sh)) $
- case shxIndex pis pshT i (coerce sh) of
+ case shxIndex i (coerce sh) of
SKnown SNat -> SNat
shsPermutePrefix :: forall is sh. Perm is -> ShS sh -> ShS (PermutePrefix is sh)