Adds support for Functor/Applicative/Constraints for records-of-functions#58
Open
dalaing wants to merge 2 commits into
Open
Adds support for Functor/Applicative/Constraints for records-of-functions#58dalaing wants to merge 2 commits into
dalaing wants to merge 2 commits into
Conversation
Owner
|
Hi @dalaing, thanks for the contribution! Could you extend the tests to |
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withParam, 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.