Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your first law is a very strong requirement; it implies that the functor can have no distinguished "shape" independent of the parametric portion. This rules out any functor that contains extra values (<code>State</code>, <code>Writer</code>, &amp;c.) as well as any functor using sum types (<code>Either</code>, <code>[]</code>, &amp;c.). So this limits us to things like fixed-size containers.</p> <p>Your second law requires commutativity, which means that order of nesting (that is, functor composition) doesn't matter. This might actually be implied by the first law, since we already know that the functor can't contain any information other than the parametric values, and you explicitly require preservation of that here.</p> <p>Your third law requires that the functor be idempotent as well, which means that nesting something within itself using fmap is equivalent to itself. This probably implies that if the functor is a monad as well, <code>join</code> involves some sort of "taking the diagonal". Basically, this means that <code>liftA2 (,)</code> should behave like <code>zip</code>, not a cartesian product. </p> <p>The second and third together imply that however many "primitives" the functor might have, any composition is equivalent to combining at most one of each primitive, in any order. And the first implies that if you throw out the parametric information, any combination of primitives is the same as using none at all.</p> <p>In summary, I think what you have is <a href="http://hackage.haskell.org/packages/archive/representable-functors/3.1/doc/html/Data-Functor-Representable.html" rel="noreferrer">the class of functors isomorphic to <code>Reader</code></a>. That is, functors where <code>f a</code> describes values of type <code>a</code> indexed by some other type, such as a subset of the natural numbers (for fixed-size containers) or an arbitrary type (as with <code>Reader</code>).</p> <p>I'm not sure how to convincingly prove most of the above, unfortunately.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload