Message from JavaScript discussions
December 2017
— And yes I'm aware of returning a function, the alternative being wrapping it in your own
const compose = (...funcs) =>
initValue =>
funcs.reduce((value, func) => func(value), initValue);
there
— Yes
— Better
— Kek
— What are nomadic function ..., can someone help me with a simple explanation
— Yes // Nope // No
— Monadic*?
— A monadic function is simply a function that returns a monad :)
— Thank you for the correction .. Its a monad
— And u defined with the same name ... So still I haven't gotten iy
— A monad is a value / object / class instance (depending on language) that satisfies a few conditions:
Has a bind method (a callback that gets called with the encapsulated value)
A unit function exists, to encapsulate a value within a monad
Promises are JavaScript examples of monads, a value can be encapsulated (unit) with Promise.resolve(value)
, and promise objects have a bind method (.then()
)