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

F# 5 applicative computation expression #268

Closed
ghost opened this issue Jan 13, 2021 · 9 comments · Fixed by #400
Closed

F# 5 applicative computation expression #268

ghost opened this issue Jan 13, 2021 · 9 comments · Fixed by #400
Milestone

Comments

@ghost
Copy link

ghost commented Jan 13, 2021

With F# 5 on the horizon, I think we should consider adding support for the new applicative computation expressions therein. This is mostly a tracking issue so we don't forget. Brief notes on this are here.

@TysonMN
Copy link
Member

TysonMN commented Jan 13, 2021

Is this a duplicate of #267?

@ghost
Copy link
Author

ghost commented Jan 13, 2021

I'm not sure what happened, thanks for bringing that up. When I submitted the first issue I got the Github 404 page and just submitted again. I've closed #267 in favor of this issue.

@TysonMN
Copy link
Member

TysonMN commented Mar 3, 2021

For which of our monadic types is its monadic behavior different from its application behavior? I do not know of any but I could be missing something.

@TysonMN
Copy link
Member

TysonMN commented Sep 5, 2021

Oh, I realized how the applicative behavior would differ from the monadic behavior.

Hedgehog currently shrinks "multiple" generators sequentially. This is required for the monadic behavior. The applicative behavior could be different; it could for example, cyclically shrink the generators until no improvement is possible (i.e. a Pareto optimal position).

I find this very interesting.

@TysonMN
Copy link
Member

TysonMN commented Sep 5, 2021

@moodmosaic, does Haskell Hedgehog have this applicative behavior?

@moodmosaic
Copy link
Member

cyclically shrink the generators until no improvement is possible

That should be possible according to @edsko's article (which is the reference). Though I don't have ghci in front me.

@ghost
Copy link
Author

ghost commented Sep 7, 2021

I was thinking of how this could differ, especially wrt apply's implied behavior of being the "parallel" equivalent to bind's "sequential" behavior. Perhaps all of the applied parameters receive the same seed and grow together? Unless that's what was already mentioned.

That would be an interesting way to control the integrated shrinking behavior of Hedgehog.

@TysonMN
Copy link
Member

TysonMN commented Sep 7, 2021

My intuition is that the applicative behavior of Random<> should match its monadic behavior.

Perhaps all of the applied parameters receive the same seed [...]

I don't think that would be a good idea. Then applicatively generating a list would produce a list with the same value throughout.

[...] and grow together?

I don't know what you mean by "grow".

@TysonMN
Copy link
Member

TysonMN commented Jan 1, 2022

This is included in version 0.12.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants