Programming Languages

Automatic Refunctionalization to a Language with Copattern Matching: With Applications to the Expression Problem

by Till­mann Ren­del, Julia Trieflinger, and Klaus Os­ter­mann

In Pro­ceed­ings of In­ter­na­tional Con­fer­ence on Func­tional Pro­gram­ming, pages 269–279. ACM, 2015.

This pub­li­ca­tion is re­lated to the Uroboro re­search pro­ject.

Ab­stract

De­func­tion­al­iza­tion and re­func­tion­al­iza­tion es­tab­lish a cor­re­spon­dence be­tween first-class func­tions and pat­tern match­ing, but the cor­re­spon­dence is not sym­met­ric: Not all uses of pat­tern match­ing can be au­to­mat­i­cally re­func­tion­al­ized to uses of higher-or­der func­tions. To rem­edy this asym­me­try, we gen­er­al­ize from first-class func­tions to ar­bi­trary co­data. This leads us to full de­func­tion­al­iza­tion and re­func­tion­al­iza­tion be­tween a co­data lan­guage based on co­pat­tern match­ing and a data lan­guage based on pat­tern match­ing.

We ob­serve how pro­grams can be writ­ten as ma­tri­ces so that they are mod­u­larly ex­ten­si­ble in one di­men­sion but not the other. In this rep­re­sen­ta­tion, de­func­tion­al­iza­tion and re­func­tion­al­iza­tion cor­re­spond to ma­trix trans­po­si­tion which ef­fec­tively changes the di­men­sion of ex­ten­si­bil­ity a pro­gram sup­ports. This sug­gests ap­pli­ca­tions to the ex­pres­sion prob­lem.

News