I want to return an array of arbitrary rank from C/C++ to Idris. I've typed the C++ array as a void*, and correspondingly have an AnyPtr in Idris. In Idris, I've defined such an Array type as a nested Vect:
Shape : {0 rank: Nat} -> Type
Shape = Vect rank Nat
Array : (0 shape : Shape) -> Type
Array [] = Int
Array (d :: ds) = Vect d (Array ds)
but I don't know how to convert the AnyPtr to the Array. I've got as far as
%foreign "C:libfoo,eval"
prim__eval : AnyPtr
export
eval : Array shape
eval = prim__eval -- doesn't type check
EDIT I fixed the element type to Int because it simplified the question without losing the important details.