Skip to content

Yoneda: More stack-efficient (.>) and (*>)#82

Merged
RyanGlScott merged 1 commit into
ekmett:masterfrom
rhendric:rhendric/yoneda-then
Jun 12, 2025
Merged

Yoneda: More stack-efficient (.>) and (*>)#82
RyanGlScott merged 1 commit into
ekmett:masterfrom
rhendric:rhendric/yoneda-then

Conversation

@rhendric

Copy link
Copy Markdown
Contributor

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

import Data.Functor.Yoneda

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

main :: IO ()
main = lowerYoneda $ times 10000 $ pure ()

@RyanGlScott RyanGlScott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@RyanGlScott RyanGlScott merged commit 52c6189 into ekmett:master Jun 12, 2025
11 checks passed
@rhendric rhendric deleted the rhendric/yoneda-then branch June 12, 2025 16:17
RyanGlScott added a commit that referenced this pull request Jun 17, 2025
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