rebuildTA
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> Tuple (PreOpenExp acc env aenv)  t
    -> Tuple (PreOpenExp acc env aenv') t
rebuildTA k v tup =
  case tup of
    NilTup      -> NilTup
    SnocTup t e -> rebuildTA k v t `SnocTup` rebuildEA k v e
rebuildTA
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> Tuple (PreOpenExp acc env aenv)  t
    -> Tuple (PreOpenExp acc env aenv') t
rebuildTA k v tup =
  case tup of
    NilTup      -> NilTup
    SnocTup t e -> rebuildTA k v t `SnocTup` rebuildEA k v e
rebuildTA k v tup =
  case tup of
    NilTup      -> NilTup
    SnocTup t e -> rebuildTA k v t `SnocTup` rebuildEA k v e