packages feed

feldspar-language-0.4.0.2: Examples/Simple/Trace.hs

module Examples.Simple.Trace where

import qualified Prelude
import Feldspar
import Feldspar.Vector
import Feldspar.Compiler

--- | Example showing the application of tracing function.
---   Creating three tracing point for each loop cycle,
---   tracing two inputs and result of '+' operation.
 
traceExample :: Data [Int32] -> Data Int32
traceExample xs = fold (\x y -> trace 3 $ trace 1 x + trace 2 y) 0 $ unfreezeVector' 255 xs