From 8a8a9eda7af43770f35b7f1078566d388b34b9a7 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 13 May 2024 19:39:17 +0200 Subject: Remove some redundant 'case' --- src/Data/Array/Nested/Internal.hs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index 78d3760..6f22e59 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -900,9 +900,8 @@ infixr 3 :.: data UnconsIxRRes i n1 = forall n. ((S n) ~ n1) => UnconsIxRRes (IxR n i) i unconsIxR :: IxR n1 i -> Maybe (UnconsIxRRes i n1) -unconsIxR (IxR sh) = case sh of - i ::: sh' -> Just (UnconsIxRRes (IxR sh') i) - ZR -> Nothing +unconsIxR (IxR (i ::: sh')) = Just (UnconsIxRRes (IxR sh') i) +unconsIxR (IxR ZR) = Nothing type IIxR n = IxR n Int @@ -933,9 +932,8 @@ infixr 3 :$: 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 +unconsShR (ShR (i ::: sh')) = Just (UnconsShRRes (ShR sh') i) +unconsShR (ShR ZR) = Nothing knownShR :: ShR n i -> Dict KnownINat n knownShR (ShR sh) = knownListR sh @@ -1120,9 +1118,8 @@ infixr 3 :.$ data UnconsIxSRes i sh1 = forall n sh. (n : sh ~ sh1) => UnconsIxSRes (IxS sh i) i unconsIxS :: IxS sh1 i -> Maybe (UnconsIxSRes i sh1) -unconsIxS (IxS shl) = case shl of - i ::$ shl' -> Just (UnconsIxSRes (IxS shl') i) - ZS -> Nothing +unconsIxS (IxS (i ::$ shl')) = Just (UnconsIxSRes (IxS shl') i) +unconsIxS (IxS ZS) = Nothing type IIxS sh = IxS sh Int @@ -1150,9 +1147,8 @@ infixr 3 :$$ 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 +unconsShS (ShS (i ::$ shl')) = Just (UnconsShSRes (ShS shl') i) +unconsShS (ShS ZS) = Nothing zeroIxS :: SShape sh -> IIxS sh zeroIxS ShNil = ZIS -- cgit v1.2.3-70-g09d2