1

Is there a function with such type signature: Exp a -> a in accelerate library for Haskell?

For example, I have an expression:

max = maximum mat !! 0

where mat :: Acc (Matrix Int)

Then, max has type Exp Int, but I'd like max to be expressed a simple haskell's Int.

1 Answers1

1

You will first need to convert the Exp into an Acc, then run that, and finally index the resulting array:

indexArray (run (unit max)) Z

Perhaps it is easier then to use the maximum array directly:

indexArray (run (maximum mat)) (0 :. Z)
Noughtmare
  • 9,410
  • 1
  • 12
  • 38