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

Run multiple readers at once by providing a record #28

Open
paluh opened this issue Jul 2, 2020 · 3 comments
Open

Run multiple readers at once by providing a record #28

paluh opened this issue Jul 2, 2020 · 3 comments

Comments

@paluh
Copy link

paluh commented Jul 2, 2020

I have this ugly prototype for runReaders: https://try.purescript.org/?gist=7fe346867c14d18e78ff06e32673ae5f . I wonder if something like this (with a better API of course) could be included in this lib. What do you think? Any ideas how to make this better - should I stick with onMatch and transform only input record?

(Ping @3ddyy - I've seen that you have improved reader API recently ;-))

@artemisSystem
Copy link
Contributor

That sounds like a good idea to me. The only thing i really learned about reader from working with it is that it's tricky 😝. I was also trying to implement a local so that the type for the read value could be different, but couldn't get it to work

@paluh
Copy link
Author

paluh commented Jul 2, 2020

@3ddyy I've updated the gist. I've added simple record mapping which prepares a given record of values for internal onMatch call. I'm not sure if the implementation is readable enough and worth a PR.
I allowed myself to use inefficient Record.insert to preserve some simplicity because I hope that this record transformation is done only once during the whole interpretation.
What do you think?

@paluh
Copy link
Author

paluh commented Jul 3, 2020

P.S. I think that something similar could be done for effect handlers like runStateAt or catchAt too.

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