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

Functor application dispatch on argument #234

Open
toumix opened this issue Nov 10, 2023 · 0 comments
Open

Functor application dispatch on argument #234

toumix opened this issue Nov 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@toumix
Copy link
Collaborator

toumix commented Nov 10, 2023

Every time we do Functor.__call__(self, other), we dispatch on self which then goes through the whole hierarchy of classes. It would be more efficient to dispatch on other instead, e.g.

Ob.__functor_call__ = lambda self, other: other.ob[self]
Box.__functor_call__ = lambda self, other: other.ar[self]
Arrow.__functor_call__ = lambda self, other: other(self.id(self.dom)).then(*map(other, self))
Functor.__call__ = lambda self, other: other.__functor_call__(self)
@toumix toumix added the enhancement New feature or request label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant