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

Allow ReaderT to work with Fluture #500

Open
svozza opened this issue Oct 30, 2020 · 4 comments
Open

Allow ReaderT to work with Fluture #500

svozza opened this issue Oct 30, 2020 · 4 comments

Comments

@svozza
Copy link

svozza commented Oct 30, 2020

Is your feature request related to a problem? Please describe.
It would be nice to be able to use the Fluture async library to work with the ReaderT monad.

Describe the solution you'd like
Seamless use the Fluture type.

Describe alternatives for how you do this now
I'm using the Async type.

Code

const C = require('crocks');
const Future = require('fluture');
const {ReaderT} = C;

const ReaderFuture = ReaderT(Future)

ReaderFuture.ask()
    .runWith()
    .fork(e => e, x => x);

This currently results in the following exception:

/Users/svozza/git/github.com/svozza/crocks-test/node_modules/crocks/Reader/ReaderT.js:23
    function () { return (_type + "( " + (Monad.type()) + " )"); }
                                                ^

TypeError: Monad.type is not a function
    at type (/Users/svozza/git/github.com/svozza/crocks-test/node_modules/crocks/Reader/ReaderT.js:23:49)
    at ReaderT (/Users/svozza/git/github.com/svozza/crocks-test/node_modules/crocks/Reader/ReaderT.js:71:29)
    at Function.ask (/Users/svozza/git/github.com/svozza/crocks-test/node_modules/crocks/Reader/ReaderT.js:33:14)
    at Object.<anonymous> (/Users/svozza/git/github.com/svozza/crocks-test/fluture.js:7:14)
    at Module._compile (internal/modules/cjs/loader.js:1085:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:791:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
@dalefrancis88
Copy link
Collaborator

Just as an initial thought, could you write something in your local codebase that modifies the prototype of Future or you could wrap it if you wanted?

@svozza
Copy link
Author

svozza commented Oct 31, 2020

Sure, but the whole point of the Fantasyland spec was to make all these types interoperable.

@dalefrancis88
Copy link
Collaborator

Sorry it's my bad, I hadn't seen the conversation on gitter so didn't have the context. The above comment was not to say that it won't be done but more to help you get through your immediate need why you waited for the change to be committed

@svozza
Copy link
Author

svozza commented Oct 31, 2020

Ah sorry, I phrased that a bit blunter than I should have! I get what ya mean.

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