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

Stream Category laws #17

Open
dakom opened this issue Aug 26, 2018 · 4 comments
Open

Stream Category laws #17

dakom opened this issue Aug 26, 2018 · 4 comments

Comments

@dakom
Copy link
Collaborator

dakom commented Aug 26, 2018

Should follow just like the Cell tests, but we need to define an Eq that works through Aff, since the only way of getting a value out of Stream is via listen

@dakom
Copy link
Collaborator Author

dakom commented Aug 26, 2018

Asked question on quickcheck-laws here: purescript-contrib/purescript-quickcheck-laws#44

@clinuxrulz
Copy link
Collaborator

clinuxrulz commented Aug 31, 2018

Sodium is synchronous. At the end of a transaction all listener callbacks that are required to be invoked are invoked.

You could use Refs for storing the result for comparison.

https://pursuit.purescript.org/packages/purescript-refs/4.1.0/docs/Effect.Ref#t:Ref

@dakom
Copy link
Collaborator Author

dakom commented Sep 2, 2018

Right on - Ref's are used in various tests, e.g. here: https://github.com/SodiumFRP/purescript-sodium/blob/master/test/Stream.test.purs#L69

Still not sure how to wrap around this in an Eq instance though... will need to play with it and see at some point :)

@clinuxrulz
Copy link
Collaborator

clinuxrulz commented Sep 3, 2018

Yep. No nice way to do this. You'll have to play dirty with unsafePerformEffect or design something similar to quickcheck that is more suitable for sodium.

Maybe turning streams into cells holding a list of tuples of the current transaction count along with the value at that moment could work.

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

No branches or pull requests

2 participants