packages feed

ArrayRef-0.1: Examples/Array/Diff.hs

-- This example demonstrates using of DiffArray and DiffUArray
import Data.ArrayBZ.Diff

main = do
          -- This section demonstrates using of DiffArray
          test_DiffArray          |>  print

          -- This section demonstrates using of DiffUArray
          test_DiffUArray         |>  print

-- Using DiffArray
test_DiffArray =
          let array = listArray (1,10) [1..10] :: DiffArray Int Double
              elements = elems array
          in (sum elements)

-- Using DiffUArray
test_DiffUArray =
          let array = listArray (1,10) [1..10] :: DiffUArray Int Double
              elements = elems array
          in (sum elements)

-- Helper operation
a |> b = b a