title: Is there a van Laarhoven representation of `Optional`
body: <p>Many types of optics have a van Laarhoven representation. </p>
  
  <p>For example, a <code>Lens</code> of type <code>Lens s t a b</code>  can be represented as:</p>
  
  <pre><code> Functor f =&gt; (a -&gt; f b) -&gt; s -&gt; f t
  </code></pre>
  
  <p>Similarly a <code>Traversal</code>, can be represented in a similar way, swapping the <code>Functor</code> constraint for <code>Applicative</code>:</p>
  
  <pre><code> Applicative f =&gt; (a -&gt; f b) -&gt; s -&gt; f t
  </code></pre>
  
  <p>Several optics frameworks, such as <a href="http://julien-truffaut.github.io/Monocle/" rel="noreferrer">Monocle</a> and <a href="https://arrow-kt.io/docs/optics/optional/" rel="noreferrer">Arrow</a> define a type called <code>Optional</code>. </p>
  
  <p><a href="https://julien-truffaut.github.io/Monocle/optics.html" rel="noreferrer">In Monocle's Optics heirarchy</a> <code>Optional</code> fits between <code>Lens</code> and <code>Traversal</code></p>
  
  <p>As I understand it: If a <code>Traversal</code> is like a <code>Lens</code> that may have <em>zero to many</em> targets, then an <code>Optional</code> is like a <code>Lens</code> that may have <em>zero to one</em> targets. </p>
  
  <p>In Monocle, <code>Optional</code> is defined as a pair of functions:</p>
  
  <pre><code>getOrModify :: s -&gt; Either t a 
  set :: (b, s) -&gt; t
  </code></pre>
  
  <p><a href="https://github.com/julien-truffaut/Monocle/blob/master/core/shared/src/main/scala/monocle/Optional.scala" rel="noreferrer">Comments in the Monocle source code</a> suggest that it's also possible to represent an <code>Optional</code> "as a weaker <code>PLens</code> and weaker <code>PPrism</code>"</p>
  
  <p>Is it possible to represent an <code>Optional</code> as a van Laarhoven function? </p>