title: What would be a good example of an endofunctor that is not the identity functor?
body: <p>In ￼<a href="https://egghead.io/lessons/javascript-linear-data-flow-with-container-style-types-box" rel="nofollow noreferrer">Professor Frisby Introduces Composable Functional JavaScript</a> the identity functor was introduced:</p>
  
  <pre><code>const Box = x =&gt; 
     ({ 
         map:  f =&gt; Box(f(x)),
         fold: f =&gt; f(x)           // for testing
     })
  </code></pre>
  
  <p>I spent the better part of the day understanding functors and why the above JavaScript code is actually the identity functor. So I thought I would alter it to get a "real" functor that is not the identity functor. I came up with this:</p>
  
  <pre><code>const Endo = x =&gt;
     ({ 
         map:  f =&gt; Endo(f(x).split('')),
         fold: f =&gt; f(x).split('') // for testing
     })
  </code></pre>
  
  <p>My reasoning is that with Box, <code>Id_Box: Box -&gt; Box</code> and <code>Id_Box f = f</code>. Endo would also map to itself but <code>Endo(f): Endo(x) -&gt; Endo(y)</code> (if <code>f: x -&gt; y</code>).</p>
  
  <p>Am I on the right track?</p>
  
  <p>EDIT:
  Replaced <code>string</code> with the more generic <code>x</code> as it was in the original examples.</p>