Git Product home page Git Product logo

Comments (12)

ncthbrt avatar ncthbrt commented on August 17, 2024 1

How would query work in this revised model?
Edit: Oh. I believe I understand. .next() returns the yielded value and the call to the next next(value) provides the return value of the yield inside the generator.

from nact.

samfrances avatar samfrances commented on August 17, 2024 1

I don't know the nact codebase well enough yet to give well informed comments on the whole branch. However, from the examples, the API looks a lot like what I had in mind. I like how you have incorporated general IO as well as actor-specific actions.

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024 1

@biancode It's not an officially supported yet (there is no documentation for this feature, less extensive tests), but the master branch of https://github.com/ncthbrt/nact has the monad variant of the library in it. You can install it by calling I believe npm install https://github.com/ncthbrt/nact.git

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024 1

I've released the monadic implementation of nact in v7.2.2-beta0 of nact on npm, would love to get some feedback on it. (Note that I have not yet added typescript bindings for the monadic wrapper around nact)

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024

from nact.

samfrances avatar samfrances commented on August 17, 2024

Redux Saga is probably a good place to look if you're looking for a model of how this sort of thing can work. Although, I wasn't necessarily suggesting a whole suite of declarative effects, just using this model for things like message dispatch.

Is it possible that generator-based actor behaviors could be provided as an option, rather than a breaking change, using a different sort of spawn function?

Happy to help in any way I can.

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024

It definitely could be possible to perhaps have a parallel API for this purpose.

require('nact/monad') which exposes identical calls to the main API, just in a side effect free manner. I'd imagine implementation wise you'd probably want to make this a wrapper around the existing implementation to reduce the maintenance and testing burden.

It's a bit unfortunate that the reason version wouldn't be able to provide a similar API. Perhaps that could be solved by using a ppx.

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024

@samfrances I'm quickly throwing together a prototype. Would appreciate a review when of that before proceeding to do the hard work of getting full coverage.

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024

@samfrances I've created a working prototype here: https://github.com/ncthbrt/nact/tree/generators
I've put an example in the examples folder. Would appreciate feedback. Note this is very far from robust, but a quick stab at an API. Note that it also includes support for const result = yield query() as well.

from nact.

samfrances avatar samfrances commented on August 17, 2024

@ncthbrt Sure thing, I'll take a look tonight. Apologies, I didn't see your message until now.

from nact.

ncthbrt avatar ncthbrt commented on August 17, 2024

Think for this change to be worthwhile, should probably think about adding a testkit to probe actors and make assertions about their expected behaviour.

from nact.

biancode avatar biancode commented on August 17, 2024

It is to find in master branch version 7.2.1, but I got

Cannot find module 'nact/monad'

on require('nact/monad')
The monad folder is not installed if I use nact as a dependency in a project.

from nact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.