Closed nomeata closed 1 year ago
While it works successfully on all coercions in a single, but non-trivial test case provided by Mike, it seems it cannot handle all coercions in the test case here.
In particular, when it finds as a coercion FunCo <t1> co :: (t1 -> a) ~ (t1 -> b)
for co :: a ~ b
, the current strategy is to use fmapC (goCoercion co)
, which requires `FunctorCat, which does not exist in all categories.
I am unsure if
Effect of this patch on the golden tests: https://gist.github.com/86ed8d282ac59b1ff5ab02749d24395a
Patch to unbreak the test suite upcoming.
This (still PoC-level) patch, as asked for by @mikesperber, changes
ccc
to not usecoerce
when encountering a Cast, but actually descend into the givenCoercion
and build an arrow in the target category “implementing” that coercion, usingrepr
,abst
,fmap
,compose
, etc.The high-level idea is to take a coercion
co :: t1 ~ t2
and turn it into an arrowt1 `k` t2
in the target category.It is still partial, and falls back to
coerce
when it finds aCoercion
it cannot handle.