Mistake in the example?
ferranpujolcamins opened this issue · 2 comments
ferranpujolcamins commented
Hi, looking at the example on the README:
// Counter.js
exports.incrCounter = function() {
if (!window.globalCounter) {
window.globalCounter = 0;
}
return ++window.globalCounter;
}and then looking at the implementation of pure, shouldn't incrCounter be thunked?:
// Counter.js
exports.incrCounter = function() {
return function() {
if (!window.globalCounter) {
window.globalCounter = 0;
}
return ++window.globalCounter;
}
}I'm trying to figure out how Effect works, so my apologies in advance if this It's just me not understanding properly.
natefaubion commented
It is already thunked with the outer function () { }.
ferranpujolcamins commented
Ah ok! Sorry I misread the signature as
foreign import incrCounter :: Unit -> Effect Int.
Now I see it is foreign import incrCounter :: Effect Int and everything makes sense. Thank you.