Repository navigation
Free Monads - #185
Merged
Merged
Free Monads#185
Conversation
Now the ambiguity problem is gone, but we run into unsolved type variables. Using the specific bind for Free instead of the generic one, should work fine. But that doesn't seem to be a good compromise.
This uses the technique of prioritizing overload resolution but in the user defined class. I adds internal complexity but makes primitive functor types usable to some extent.
The support for primitive functor types will be limited, as shown on this test, type annotations are needed or type inference needs to be driven to the right order of resolution. It's still better than no support at all for primitive functor types.
Member
Author
|
I'm willing to merge this. It worths noting that finally I found a good compromise to the issue with the primitive types, which makes them usable to some extent. I think the only open question at this point is the naming we're using. Any thoughts? |
Member
|
I think that naming is fine. |
Member
|
I haven't grokked the free monad things, so I can't offer an opinion on the names. |
cannorin
approved these changes
Sep 19, 2019
Needs more testing (primitives and externals)
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 PR will introduce generic Free Monads !
We need to discuss the names (Pure, Roll, Free, Join), create tests and add sample code.
And of course some docs would be ideal but these last years there were many posts about Free Monads in the context of dependency injection.
I tried coding this sample and works up to the definition of
exF2, I still haven't found a workaround but realized that if we useMap.InvokeOnInstanceand restrict the Free Monads to the user defined types (excluding primitive functor types) it works fully. So that's a B plan.