title: Composing promise and a custom monad
body: <p><strong>Context</strong></p>
  
  <p>I'm trying to understand the problematic that monades try to solve and I'm a bit confused while trying to compose a container and a promise.</p>
  
  <p><strong>Example</strong></p>
  
  <p>For the purpose of the exercise, I've modified the <code>chain</code> method of my monad to a <code>then</code>, so that I can compose promises with my custom container:</p>
  
  <pre><code>const assert = require("assert");
  const R = require("ramda");
  
  const makeMonad = value =&gt; ({
    get: () =&gt; value,
    map: transform =&gt; makeMonad(transform(value)),
    then: createMonad =&gt; makeMonad(createMonad(value).get())
  });
  
  const asyncAdd2 = x =&gt; Promise.resolve(x + 2);
  
  const composeP = R.composeWith((f, last) =&gt; last.then(f));
  const asyncResult = composeP([asyncAdd2, makeMonad])(1);
  
  asyncResult.then(x =&gt; assert.equal(x, 3));
  console.log("Passed");
  </code></pre>
  
  <p>In this example, I have an error thrown because the <code>Promise</code> API doesn't own a <code>get</code> function. In fact, I need this <code>get</code> function in my custom <code>then</code> function to allow composability.</p>
  
  <p>So at the end of the application execution, depending on the order of my arguments in the <code>composeWith</code> call, I'm in a promise world or in a custom monad world.</p>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li><p>I m now wondering if I have to lift everything (even promises?) while I'm working and trying to compose monades?</p></li>
  <li><p>What is the impact if I'm working with 10 kind of different monades? I mean, depending on the order, I'll probably change the world I'm working on no?</p></li>
  <li><p>Is this something common to create monades creators? I mean creating the monade definition like the <code>makeMonad</code> I've written</p></li>
  </ul>
  
  <p>Thanks for your help, I hope I've been clear ^^'</p>