shrinkEA :: ShrinkAcc acc -> PreOpenExp acc env aenv t -> PreOpenExp acc env aenv t
shrinkEA s exp =
  case exp of
    Let bnd body        -> Let (shrinkEA s bnd) (shrinkEA s body)
    Var idx             -> Var idx
    Const c             -> Const c
    Tuple t             -> Tuple (shrinkTA s t)
    Prj tup e           -> Prj tup (shrinkEA s e)
    IndexNil            -> IndexNil
    IndexCons sl sz     -> IndexCons (shrinkEA s sl) (shrinkEA s sz)
    IndexHead sh        -> IndexHead (shrinkEA s sh)
    IndexTail sh        -> IndexTail (shrinkEA s sh)
    IndexSlice x ix sh  -> IndexSlice x (shrinkEA s ix) (shrinkEA s sh)
    IndexFull x ix sl   -> IndexFull x (shrinkEA s ix) (shrinkEA s sl)
    IndexAny            -> IndexAny
    ToIndex sh ix       -> ToIndex (shrinkEA s sh) (shrinkEA s ix)
    FromIndex sh i      -> FromIndex (shrinkEA s sh) (shrinkEA s i)
    Cond p t e          -> Cond (shrinkEA s p) (shrinkEA s t) (shrinkEA s e)
    Iterate n f x       -> Iterate (shrinkEA s n) (shrinkEA s f) (shrinkEA s x)
    PrimConst c         -> PrimConst c
    PrimApp f x         -> PrimApp f (shrinkEA s x)
    Index a sh          -> Index (s a) (shrinkEA s sh)
    LinearIndex a i     -> LinearIndex (s a) (shrinkEA s i)
    Shape a             -> Shape (s a)
    ShapeSize sh        -> ShapeSize (shrinkEA s sh)
    Intersect sh sz     -> Intersect (shrinkEA s sh) (shrinkEA s sz)
shrinkEA :: ShrinkAcc acc -> PreOpenExp acc env aenv t -> PreOpenExp acc env aenv t
shrinkEA s exp =
  case exp of
    Let bnd body        -> Let (shrinkEA s bnd) (shrinkEA s body)
    Var idx             -> Var idx
    Const c             -> Const c
    Tuple t             -> Tuple (shrinkTA s t)
    Prj tup e           -> Prj tup (shrinkEA s e)
    IndexNil            -> IndexNil
    IndexCons sl sz     -> IndexCons (shrinkEA s sl) (shrinkEA s sz)
    IndexHead sh        -> IndexHead (shrinkEA s sh)
    IndexTail sh        -> IndexTail (shrinkEA s sh)
    IndexSlice x ix sh  -> IndexSlice x (shrinkEA s ix) (shrinkEA s sh)
    IndexFull x ix sl   -> IndexFull x (shrinkEA s ix) (shrinkEA s sl)
    IndexAny            -> IndexAny
    ToIndex sh ix       -> ToIndex (shrinkEA s sh) (shrinkEA s ix)
    FromIndex sh i      -> FromIndex (shrinkEA s sh) (shrinkEA s i)
    Cond p t e          -> Cond (shrinkEA s p) (shrinkEA s t) (shrinkEA s e)
    Iterate n f x       -> Iterate (shrinkEA s n) (shrinkEA s f) (shrinkEA s x)
    PrimConst c         -> PrimConst c
    PrimApp f x         -> PrimApp f (shrinkEA s x)
    Index a sh          -> Index (s a) (shrinkEA s sh)
    LinearIndex a i     -> LinearIndex (s a) (shrinkEA s i)
    Shape a             -> Shape (s a)
    ShapeSize sh        -> ShapeSize (shrinkEA s sh)
    Intersect sh sz     -> Intersect (shrinkEA s sh) (shrinkEA s sz)
shrinkEA s exp =
  case exp of
    Let bnd body        -> Let (shrinkEA s bnd) (shrinkEA s body)
    Var idx             -> Var idx
    Const c             -> Const c
    Tuple t             -> Tuple (shrinkTA s t)
    Prj tup e           -> Prj tup (shrinkEA s e)
    IndexNil            -> IndexNil
    IndexCons sl sz     -> IndexCons (shrinkEA s sl) (shrinkEA s sz)
    IndexHead sh        -> IndexHead (shrinkEA s sh)
    IndexTail sh        -> IndexTail (shrinkEA s sh)
    IndexSlice x ix sh  -> IndexSlice x (shrinkEA s ix) (shrinkEA s sh)
    IndexFull x ix sl   -> IndexFull x (shrinkEA s ix) (shrinkEA s sl)
    IndexAny            -> IndexAny
    ToIndex sh ix       -> ToIndex (shrinkEA s sh) (shrinkEA s ix)
    FromIndex sh i      -> FromIndex (shrinkEA s sh) (shrinkEA s i)
    Cond p t e          -> Cond (shrinkEA s p) (shrinkEA s t) (shrinkEA s e)
    Iterate n f x       -> Iterate (shrinkEA s n) (shrinkEA s f) (shrinkEA s x)
    PrimConst c         -> PrimConst c
    PrimApp f x         -> PrimApp f (shrinkEA s x)
    Index a sh          -> Index (s a) (shrinkEA s sh)
    LinearIndex a i     -> LinearIndex (s a) (shrinkEA s i)
    Shape a             -> Shape (s a)
    ShapeSize sh        -> ShapeSize (shrinkEA s sh)
    Intersect sh sz     -> Intersect (shrinkEA s sh) (shrinkEA s sz)