con-kitty / categorifier

Interpret Haskell programs into any cartesian closed category.
BSD 3-Clause "New" or "Revised" License
57 stars 2 forks source link

simplify unsupported interpretations #54

Open zliu41 opened 2 years ago

zliu41 commented 2 years ago

In Categorifier, we may try to interpret / @(Native Double) to a category that doesn't support the Native newtype. This will fail, but if we catch that, we can specalize and inline / so that it ends up using the underlying / @Double, which is supported.

However, if we blindly catch and inline any interpretation that fails, we can easily find ourselves in a loop rather than reporting a real error. This needs to be handled delicately to avoid loops.

(Extricated from https://kitty-hawk.atlassian.net/browse/SW-3106)