The types associated to our typed lambda expressions often need to be curried, uncurried, interchanged, etc.
The way that these type-juggling operations are currently implemented can be a bit hacky -- e.g. see this instance in our code where we have a try/except block that first tries one thing and then if the types don't work out, tries the interchanged version.
It would be good to figure out how to deal with these type juggling operations systematically. I am unsure if this would be a straightforward adjustment, or if it would require more work.
One tentative idea to deal with interchange is to express it via typed closed lambda terms (combinators).
E.g. if we want to convert a term of type (a->b)x(c->d) to axc->bxd, this can be done by feeding the original term into a combinator (a->b)x(c->d)->(axc->bxd).
The types associated to our typed lambda expressions often need to be curried, uncurried, interchanged, etc.
The way that these type-juggling operations are currently implemented can be a bit hacky -- e.g. see this instance in our code where we have a try/except block that first tries one thing and then if the types don't work out, tries the interchanged version.
It would be good to figure out how to deal with these type juggling operations systematically. I am unsure if this would be a straightforward adjustment, or if it would require more work.
One tentative idea to deal with interchange is to express it via typed closed lambda terms (combinators).
E.g. if we want to convert a term of type
(a->b)x(c->d)toaxc->bxd, this can be done by feeding the original term into a combinator(a->b)x(c->d)->(axc->bxd).