From 260e00c3d661c21de5986ccf01d3292d3b8f7633 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 29 Jun 2025 12:36:03 +0200 Subject: Flip some index/shape-related functions This ensures that the argument order consistently puts the main thing being operated on at the end, and supporting singletons at the start. --- src/Data/Array/Nested/Convert.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Data/Array/Nested/Convert.hs') diff --git a/src/Data/Array/Nested/Convert.hs b/src/Data/Array/Nested/Convert.hs index b68c8b0..861bf20 100644 --- a/src/Data/Array/Nested/Convert.hs +++ b/src/Data/Array/Nested/Convert.hs @@ -175,7 +175,7 @@ convert = \c x -> munScalar (go c (mscalar x)) go (ConvXR @_ @sh) (M_Nest @esh esh x) | Refl <- lemRankAppRankEqRepNo (Proxy @esh) (Proxy @sh) = let ssx' = ssxAppend (ssxFromShX esh) - (ssxReplicate (shxRank (shxDropSSX @esh @sh (mshape x) (ssxFromShX esh)))) + (ssxReplicate (shxRank (shxDropSSX @esh @sh (ssxFromShX esh) (mshape x)))) in M_Ranked (M_Nest esh (mcast ssx' x)) go ConvXS (M_Nest esh x) = M_Shaped (M_Nest esh x) go (ConvXS' @sh @sh' sh') (M_Nest @esh esh x) @@ -197,7 +197,7 @@ convert = \c x -> munScalar (go c (mscalar x)) = x go (ConvNest @_ @sh @sh' ssh) (M_Nest @esh esh x) | Refl <- lemAppAssoc (Proxy @esh) (Proxy @sh) (Proxy @sh') - = M_Nest esh (M_Nest (shxTakeSSX (Proxy @sh') (mshape x) (ssxFromShX esh `ssxAppend` ssh)) x) + = M_Nest esh (M_Nest (shxTakeSSX (Proxy @sh') (ssxFromShX esh `ssxAppend` ssh) (mshape x)) x) go (ConvUnnest @sh @sh') (M_Nest @esh esh (M_Nest _ x)) | Refl <- lemAppAssoc (Proxy @esh) (Proxy @sh) (Proxy @sh') = M_Nest esh x -- cgit v1.2.3-70-g09d2