From 88af4cd5c6787d41c59ec6bad785719fa0da5d11 Mon Sep 17 00:00:00 2001
From: "Trevor L. McDonell" <tmcdonell@cse.unsw.edu.au>
Date: Wed, 3 Sep 2014 11:04:04 +0200
Subject: [PATCH] remove silly identity function

fixes AccelerateHS/accelerate#195
---
 Data/Array/Accelerate/Trafo/Fusion.hs | 48 +++------------------------
 1 file changed, 4 insertions(+), 44 deletions(-)

diff --git a/Data/Array/Accelerate/Trafo/Fusion.hs b/Data/Array/Accelerate/Trafo/Fusion.hs
index f0d7fd6ca..88e159114 100644
--- a/Data/Array/Accelerate/Trafo/Fusion.hs
+++ b/Data/Array/Accelerate/Trafo/Fusion.hs
@@ -392,54 +392,14 @@ embedPreAcc fuseAcc embedAcc elimAcc pacc
     stencil x f a       = Stencil f x a
     stencil2 x y f a b  = Stencil2 f x a y b
 
-    -- Conversions for closed scalar functions and expressions, with
-    -- pre-simplification. We don't bother traversing array-valued terms in
-    -- scalar expressions, as these are guaranteed to only be array variables.
+    -- Conversions for closed scalar functions and expressions. This just
+    -- applies scalar simplifications.
     --
     cvtF :: PreFun acc aenv t -> PreFun acc aenv t
-    cvtF = cvtF' . simplify
+    cvtF = simplify
 
     cvtE :: PreExp acc aenv' t -> PreExp acc aenv' t
-    cvtE = cvtE' . simplify
-
-    -- Conversions for scalar functions and expressions without
-    -- pre-simplification. Hence we can operate on open expressions.
-    --
-    cvtF' :: PreOpenFun acc env aenv' t -> PreOpenFun acc env aenv' t
-    cvtF' (Lam f)  = Lam  (cvtF' f)
-    cvtF' (Body b) = Body (cvtE' b)
-
-    cvtE' :: PreOpenExp acc env aenv' t -> PreOpenExp acc env aenv' t
-    cvtE' exp =
-      case exp of
-        Let bnd body            -> Let (cvtE' bnd) (cvtE' body)
-        Var ix                  -> Var ix
-        Const c                 -> Const c
-        Tuple tup               -> Tuple (cvtT tup)
-        Prj tup ix              -> Prj tup (cvtE' ix)
-        IndexNil                -> IndexNil
-        IndexCons sh sz         -> IndexCons (cvtE' sh) (cvtE' sz)
-        IndexHead sh            -> IndexHead (cvtE' sh)
-        IndexTail sh            -> IndexTail (cvtE' sh)
-        IndexAny                -> IndexAny
-        IndexSlice x ix sh      -> IndexSlice x (cvtE' ix) (cvtE' sh)
-        IndexFull x ix sl       -> IndexFull x (cvtE' ix) (cvtE' sl)
-        ToIndex sh ix           -> ToIndex (cvtE' sh) (cvtE' ix)
-        FromIndex sh ix         -> FromIndex (cvtE' sh) (cvtE' ix)
-        Cond p t e              -> Cond (cvtE' p) (cvtE' t) (cvtE' e)
-        While p f x             -> While (cvtF' p) (cvtF' f) (cvtE' x)
-        PrimConst c             -> PrimConst c
-        PrimApp f x             -> PrimApp f (cvtE' x)
-        Index a sh              -> Index a (cvtE' sh)
-        LinearIndex a i         -> LinearIndex a (cvtE' i)
-        Shape a                 -> Shape a
-        ShapeSize sh            -> ShapeSize (cvtE' sh)
-        Intersect s t           -> Intersect (cvtE' s) (cvtE' t)
-        Foreign ff f e          -> Foreign ff (cvtF' f) (cvtE' e)
-
-    cvtT :: Tuple (PreOpenExp acc env aenv') t -> Tuple (PreOpenExp acc env aenv') t
-    cvtT NilTup          = NilTup
-    cvtT (SnocTup tup e) = cvtT tup `SnocTup` cvtE' e
+    cvtE = simplify
 
     -- Helpers to embed and fuse delayed terms
     --