-- Pretty print nested pairs as a proper tuple.
--
prettyTuple :: forall acc env aenv t.
               PrettyAcc acc -> Int -> Int -> Tuple (PreOpenExp acc env aenv) t -> Doc
prettyTuple pp lvl alvl exp = parens $ sep (map (<> comma) (init es) ++ [last es])
  where
    es = collect exp
    --
    collect :: Tuple (PreOpenExp acc env aenv) t' -> [Doc]
    collect NilTup          = []
    collect (SnocTup tup e) = collect tup ++ [prettyPreExp pp lvl alvl noParens e]

-- Pretty print an index for a tuple projection
--
prettyTuple :: forall acc env aenv t.
               PrettyAcc acc -> Int -> Int -> Tuple (PreOpenExp acc env aenv) t -> Doc
prettyTuple pp lvl alvl exp = parens $ sep (map (<> comma) (init es) ++ [last es])
  where
    es = collect exp
    --
    collect :: Tuple (PreOpenExp acc env aenv) t' -> [Doc]
    collect NilTup          = []
    collect (SnocTup tup e) = collect tup ++ [prettyPreExp pp lvl alvl noParens e]

-- Pretty print an index for a tuple projection
--
prettyTuple pp lvl alvl exp = parens $ sep (map (<> comma) (init es) ++ [last es])
  where
    es = collect exp
    --
    collect :: Tuple (PreOpenExp acc env aenv) t' -> [Doc]
    collect NilTup          = []
    collect (SnocTup tup e) = collect tup ++ [prettyPreExp pp lvl alvl noParens e]

-- Pretty print an index for a tuple projection
--