Skip to content

Spar Polysemy: Random effect #1815

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 3 commits into from
Sep 29, 2021
Merged

Spar Polysemy: Random effect #1815

merged 3 commits into from
Sep 29, 2021

Conversation

isovector
Copy link
Contributor

@isovector isovector commented Sep 27, 2021

This PR minimizes the MonadIO footprint still in Spar, by creating an effect that can generate random things.

Checklist

  • The PR Title explains the impact of the change.
  • The PR description provides context as to why the change should occur and what the code contributes to that effect.
  • A file with the changelog entry in one or more suitable sub-sections. The sub-sections are marked by directories inside changelog.d.

@@ -0,0 +1,14 @@
module Spar.Sem.Random where
Copy link
Contributor

Choose a reason for hiding this comment

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

What about this one? https://hackage.haskell.org/package/polysemy-zoo-0.7.0.1/docs/Polysemy-Random.html

I think this is fine for now, but I don't know if I like the abstraction. I would have made a more datatype-oblivious effect and then written application logic that uses that, and implements the functions below.

The way it looks now, I have to pull in the effect for generating scim tokens when i only want bytes for something completely unrelated.

I suppose you did this because it's easy to do and revisit and understand later? I'm happy with keeping it as is, just checking :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general, I think application-level effects should be as specific as possible. There's not much value in writing a really abstract effect, just to immediately specialize it. I'd be sympathetic to the argument that maybe we should expose these as Input UUID, or something, but I'm not entirely sure what it would buy us.

@isovector isovector changed the base branch from logger-effect to develop September 29, 2021 02:07
@isovector isovector changed the base branch from develop to logger-effect September 29, 2021 02:09
@isovector isovector changed the base branch from logger-effect to develop September 29, 2021 02:10
@isovector isovector changed the base branch from develop to logger-effect September 29, 2021 02:11
@isovector isovector changed the base branch from logger-effect to develop September 29, 2021 02:31
@isovector isovector merged commit 428a9e5 into develop Sep 29, 2021
@isovector isovector deleted the spar-random-effects branch September 29, 2021 05:45
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