We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I dont know is it real issue or it has to work like that but i dont like it :) Say i have a code like this:
const {Maybe} = require("monet"); const state = { historyo: [ { html: "test", }, ], }; const MS = Maybe.fromNull(state); console.log(MS); const MS1 = MS.map(x => x.history); console.log(MS1);
const {Maybe} = require("monet");
const state = {
historyo: [
{
html: "test",
},
],
};
const MS = Maybe.fromNull(state);
console.log(MS);
const MS1 = MS.map(x => x.history);
console.log(MS1);
Does this code shouldnt return monadic state of nothing? i'm getting an error
monet.js:432 throw "Illegal state exception" ^ Illegal state exception
The text was updated successfully, but these errors were encountered:
@poulius Is historyo typo made on purpose? If yes, then you may want to change the last line: const MS1 = MS.flatMap(x => Maybe.fromNull(x.history));
historyo
const MS1 = MS.flatMap(x => Maybe.fromNull(x.history));
Sorry, something went wrong.
oh thanks, and yes historyo is on purpose. I thought map will automaticlay returns Nothing but thanks i will use your example :)
map
Nothing
.map behaviour rationale can be found in this discussion #53 (comment)
.map
No branches or pull requests
Hello,
I dont know is it real issue or it has to work like that but i dont like it :)
Say i have a code like this:
const {Maybe} = require("monet");
const state = {
historyo: [
{
html: "test",
},
],
};
const MS = Maybe.fromNull(state);
console.log(MS);
const MS1 = MS.map(x => x.history);
console.log(MS1);
Does this code shouldnt return monadic state of nothing? i'm getting an error
monet.js:432 throw "Illegal state exception" ^ Illegal state exception
The text was updated successfully, but these errors were encountered: