Skip to content

Conversation

@LukaHorvat
Copy link
Contributor

Instead of manually passing the state token around this introduces a couple of functions to wrap it up in IO. In my testing the performance is the same.

Whether you find this easier to work with or not is, of course, up to you. Feel free to close the PR if you don't think this is an improvement.

Note: I'm using unsafeDupablePerformIO everywhere and the performance is the same as before but if I instead used unsafePerformIO on the appDiffOp function (like it seems the original code does) then the performance on the quickcheck example drops somewhat.

@noughtmare
Copy link
Owner

Thank you! I have some ideas for improving the readability even more, but I'll merge this first.

@noughtmare noughtmare merged commit c341dd1 into noughtmare:main Jan 30, 2025
3 checks passed
@noughtmare
Copy link
Owner

@LukaHorvat I've worked out my ideas here: 3a6928f.

@LukaHorvat
Copy link
Contributor Author

Nice! Is there really a benefit to having the unlifted data version if you always have to convert to and from the lifted variant?

@noughtmare
Copy link
Owner

Yes. GHC can optimize the lifted variant away, as long as you immediately pattern match on it.

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