-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Shouldn't IO::bind be lazy? #27
Comments
Hello, Mr. Popov. In your example, the function prints |
Isn't the whole point of
I'm not sure I fully understand what you mean. |
I just started to learn and use all these functional things but the samples I've seen in js and typescript libraries are definitely lazy and I thought that they work in the same way no matter what language you use. Here is another example based on fp-ts library: import { pipe } from 'fp-ts/lib/pipeable';
import { IO, chain } from 'fp-ts/lib/IO';
const log1 = (): IO<void> => () => console.log('LOG1');
const run = pipe(
log1(),
chain(() => () => console.log('LOG2')),
);
run(); It's different from the implementation above but it works in the same way, |
Consider the following code:
It prints
LOG 1
even$io->exec()
is not called.The text was updated successfully, but these errors were encountered: