Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monadic Interfaces #229

Open
BebeSparkelSparkel opened this issue Jul 12, 2024 · 3 comments
Open

Monadic Interfaces #229

BebeSparkelSparkel opened this issue Jul 12, 2024 · 3 comments

Comments

@BebeSparkelSparkel
Copy link
Collaborator

I'm not sure if this is a good idea or not but I have been thinking about monadic interfaces and the pure interface can just use Identity to use the monadic instance or the RULES pragma for the specific type function. Example

@L0neGamer
Copy link
Contributor

I like the concept a lot, since it lets us have more generality. I'd recommend looking at the difference in code gen at a core level to see whether we're taking a performance hit even though we're using Identity

@L0neGamer
Copy link
Contributor

We also need to think about how this would break backwards compatibility as well as the fact that many structures wouldn't have monadic implementations like this.

Would we remove the pure versions from the classes and implement them in terms of the Monadic, or have both and define them in terms of each other? Would this mean eg updateMap wouldn't be defined with updateWithKey? Or do we keep the hierarchies as they are?

@BebeSparkelSparkel
Copy link
Collaborator Author

BebeSparkelSparkel commented Jul 13, 2024

I do not think that we can break the interface.

Existing classes can have a monadic class added to them with the *M names.

For future classes depending on what makes the most sense, we can require that either

  • new classes are the monadic version with pure Identity function wrappers with RULES pragmas for the pure versions
  • or both monadic and pure classes are defined

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

No branches or pull requests

2 participants