title: Design code to avoid rewriting during maintenance
body: <p>I have <code>lens</code> based code that expects a certain data structure:</p>
  
  <pre><code>makeLenses ''Pool
  ...
  pool ^. objects ^? _head :: Maybe Object
  </code></pre>
  
  <p>This code assumes that:</p>
  
  <pre><code>objects ::
    Functor f =&gt;
    ([Object] -&gt; f [Object]) -&gt; Pool -&gt; f Pool
  </code></pre>
  
  <p>But I want to introduce new information to the structure and new lens will become:</p>
  
  <pre><code>objects ::
    Functor f =&gt;
    ([DebugInfo Object] -&gt; f [DebugInfo Object]) -&gt; Pool -&gt; f Pool
  </code></pre>
  
  <p>My goal is to avoid any changes existing code as if it were complex project under maintenance.</p>
  
  <p>Since I use <code>lens</code> library, I suppose it should be possible to provide a new module providing a "backported" <code>objects</code> lens so that I do not need to change old code (except imports maybe).</p>
  
  <p>Is this plausible approach? Is there is a limitation lurking somewhere? Type classes or module system come to mind. I also suspect that I may have a problem with old code being unable to "reconstruct" a new structure. Do I need row type polymorphism to do that?</p>
  
  <p>Lastly, if this can be done, how should I structure my modules to keep proper separation?</p>