[<<][rtl][>>][..]
Thu May 30 16:46:23 EDT 2019

Can it just be a functor?

Until that is resolved, there is not a good way to work with this.

Maybe take the view that these arrays are Functors, such that any
operations on elements can be mapped over arrays?

When in doubt, make it a functor...


Start there.  That should bring us full circle: back to Feldspar.

Loops then come from fmap.
This can then be generalized to fold.
Any other context-aware operations will be generalizations of that.


Do I just need to start from scratch, ensuring a proper interface?

Is traverse the same as map, but for "monadic primitives"?


map:      (a -> b)   -> t a -> t b

traverse: (a -> f b) -> t a -> f (t b)


yes.



So next: build this from the ground up.  Start from traverse, then add
all the extensions such as parameterized indices.




traverse: (a -> M b) -> A a -> M (A b)

where M is the compilation/interpretation monad, and A is the array
representation.  e.g.  type A = (Index ->)

Then generalize to expose index

traverse1: (Index -> a -> M b) -> A a -> M (A b)

traverse2: (Index -> Size -> a -> M b) -> A a -> M (A b)
 

This is really a different view from not expressing inputs explicitly.
Maybe that is the core of the issue?  I've been focusing on
construction, with any inputs abstract, which removes the 'a' parameter:

loop: (Index -> Size -> M b) -> M (A b)
 






[Reply][About]
[<<][rtl][>>][..]