Skip to content

Adds support for Functor/Applicative/Constraints for records-of-functions#58

Open
dalaing wants to merge 2 commits into
jcpetruzza:masterfrom
dalaing:record-of-functions
Open

Adds support for Functor/Applicative/Constraints for records-of-functions#58
dalaing wants to merge 2 commits into
jcpetruzza:masterfrom
dalaing:record-of-functions

Conversation

@dalaing

@dalaing dalaing commented Feb 19, 2026

Copy link
Copy Markdown

This is to fix #19. It is probably a starting point for a discussion rather than an immediate win.

I've had a separate repository carrying around a patch and some orphan instances for a while - because I was worried about the new instances breaking existing code - but it occurred to me that these instances have an outer constructor of (->) where the other instances are dealing with Param, so there might not be any interference.

I tried to generalise this to arbitrary functors, but ran into trouble with the base cases.

There is an annoying cases where there is some overlap between these instances and the instance for ( Functor h ) => GFunctor n f g (Rec (h (P n f a')) (h (f a))) (Rec (h (P n g a')) (h (g a))) etc...

It turns out they are equivalent when h ~ ((->) x) but it is a bit nasty. I'm trying to work out if I could change my instances to work for two argument functions to get rid of this overlap, but it isn't clear to me if that is the winning move here.

@jcpetruzza

Copy link
Copy Markdown
Owner

Hi @dalaing, thanks for the contribution! Could you extend the tests to
cover the case of multiple arguments?

@dalaing

dalaing commented Feb 22, 2026

Copy link
Copy Markdown
Author

@jcpetruzza Done! Can't believe I missed them 😅

I've been doing some crazy stuff with these instances as orphans, I'm keen to write up my adventures at some point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for capability-style records

2 participants