rebuildAfun
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> PreOpenAfun acc aenv  t
    -> PreOpenAfun acc aenv' t
rebuildAfun k v afun =
  case afun of
    Abody b     -> Abody (k v b)
    Alam f      -> Alam (rebuildAfun k (shiftA k v) f)
rebuildAfun
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> PreOpenAfun acc aenv  t
    -> PreOpenAfun acc aenv' t
rebuildAfun k v afun =
  case afun of
    Abody b     -> Abody (k v b)
    Alam f      -> Alam (rebuildAfun k (shiftA k v) f)
rebuildAfun k v afun =
  case afun of
    Abody b     -> Abody (k v b)
    Alam f      -> Alam (rebuildAfun k (shiftA k v) f)