rebuildFA
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> PreOpenFun acc env aenv  t
    -> PreOpenFun acc env aenv' t
rebuildFA k v fun =
  case fun of
    Body e      -> Body (rebuildEA k v e)
    Lam f       -> Lam  (rebuildFA k v f)


-- Shrinking ===================================================================
--
-- The shrinking substitution arises as a restriction of beta-reduction to cases
-- where the bound variable is used zero (dead-code elimination) or one (linear
-- inlining) times.
--

-- Scalar expressions
-- ------------------
rebuildFA
    :: SyntacticAcc f
    => RebuildAcc acc
    -> (forall t'. Arrays t' => Idx aenv t' -> f acc aenv' t')
    -> PreOpenFun acc env aenv  t
    -> PreOpenFun acc env aenv' t
rebuildFA k v fun =
  case fun of
    Body e      -> Body (rebuildEA k v e)
    Lam f       -> Lam  (rebuildFA k v f)


-- Shrinking ===================================================================
--
-- The shrinking substitution arises as a restriction of beta-reduction to cases
-- where the bound variable is used zero (dead-code elimination) or one (linear
-- inlining) times.
--

-- Scalar expressions
-- ------------------
rebuildFA k v fun =
  case fun of
    Body e      -> Body (rebuildEA k v e)
    Lam f       -> Lam  (rebuildFA k v f)


-- Shrinking ===================================================================
--
-- The shrinking substitution arises as a restriction of beta-reduction to cases
-- where the bound variable is used zero (dead-code elimination) or one (linear
-- inlining) times.
--

-- Scalar expressions
-- ------------------