Is there a class property of the Control.Arrow class that represents
the evaluatation of an arrow:
eval :: (Arrow a)=>a b c->b->c
I am writing some higher order code that I would like to
work with either functions or partial functions (implemented as balanced binary
search trees) and don’t want to write separate instances for each
concrete arrow type. For example, consider the example below:
divideAndConquer::( Arrow a, Bifunctor m)=>(m c y->y)->a
b c->(x->m b x)->x->y
divideAndConquer combine solve divide = combine.(bimap (eval
solve) (divideAndConquer combine solve divide)).divide
that implements datatype generic divide and conquer. divide
encodes how to decompose a problem of type x into subproblems, solve encodes
how to solve indivisible sub-problems, and combine encodes how to put the
sub-solutions together. The branching strategy is encoded in the
bifunctor, and the use of eval faciliatates either evaluating a function or
looking up solutions in a table.