// a => Promise(b) const getUserById = id => id === 3 ? Promise.resolve({ name: 'Kurt', role: 'Author' }) : undefined ;
JavaScript Monads Made Simple
Eric Elliott

Not sure if this is normal on the monadic world, but a function should always return the same type if possible. Usually, when a function returns a promise it also returns a promise in case they fail. Why are you returning undefined instead of Promise.resolve(undefined) ?