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

Please, move Kleisli HOFs to separate *F type classes, while main class instances should be specialized to what the class instances are for #864

Closed
Anton-Latukha opened this issue Feb 27, 2021 · 1 comment

Comments

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Feb 27, 2021

The initial HNix code has a fully open structure.

So all functions become HOFs that thread pass-though some implementation.

During factoring-out the function application from demand - I noticed - that yes - it simplifies the code, but that HOF legacy gets lost.

Having HOFs for everything is nice to preserve.

Had an epiphany. HOF functions move to the top-level. Class instances specialize HOFs to the HNix implementation.
Proper argument ordering (that currently happens) allows:

So force instead of force: forall . HOF it becomes forceF kleisli. The force becomes force = forceF pure. With that, we would leverage all work & code done and would have simultaneously the HOF abilities and the code elegance and I believe the performance. Because for GHC is easy to understand that class MonadThunk: force = forceF pure is constant and so the function is specialized to the class, giving us free to all this.

The #850 works on it also.
In #776 noted that Value methods are HOFs that can form the class instances.

@Anton-Latukha Anton-Latukha changed the title Please, move HOFs to toplevel, while class instances should be specialized to for what the class instances are for Please, move HOFs to toplevel, while class instances should be specialized to what the class instances are for Feb 27, 2021
Anton-Latukha added a commit that referenced this issue Feb 27, 2021
Anton-Latukha added a commit that referenced this issue Feb 27, 2021
@Anton-Latukha Anton-Latukha changed the title Please, move HOFs to toplevel, while class instances should be specialized to what the class instances are for Please, move Kleisli HOFs to separate *F type classes, while main class instances should be specialized to what the class instances are for Feb 28, 2021
@Anton-Latukha
Copy link
Collaborator Author

With:
#871
#872
#873
#874
#875

this is closed.

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

1 participant