Skip to content

Final: More stack-efficient (.>) and (*>) #10

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

rhendric
Copy link
Contributor

To see the difference, run this file before and after patch with GHCRTS=-K100k cabal exec runghc:

import Data.Functor.Combinator

times :: Applicative f => Integer -> f a -> f a
times 1 m = m
times n m = m *> times (n - 1) m

main :: IO ()
main = retract $ times 10000 $ pure @(Final Monad IO) ()

@mstksg
Copy link
Owner

mstksg commented Jun 13, 2025

Appreciate it, thanks so much! :)

@mstksg mstksg merged commit c503733 into mstksg:master Jun 13, 2025
@rhendric rhendric deleted the rhendric/final-then branch June 13, 2025 04:22
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

Successfully merging this pull request may close these issues.

2 participants