<p>There are a few reasonable vantage points from which to tackle this problem. My strategy here, while perhaps a little unpolished, does the job just fine, while illustrating the key ideas without too many technical complications.</p>
<p>This answer has two parts. The first part, which can be read independently if the reader is short of time, presents the chosen perspective and the main conclusion. The second part expands on that by providing detailed justification. At its very end, there is a concise list of things allowed and forbidden by the <code>Traversable</code> laws.</p>
<p>The answer grew a little long, so here is a list of section headings for skipping around with Ctrl+F:</p>
<ul>
<li><p>Part one</p>
<ul>
<li>Shape and contents</li>
<li>Duplicating effects</li>
<li>The free applicative presentation</li>
</ul>
</li>
<li><p>Part two</p>
<ul>
<li>Fillable and Traversable, up close</li>
<li>Duplicating effects: once more, with feeling</li>
<li>foldMapDefault and the other naturality law</li>
<li>Executive summary: dos and don'ts of Traversable</li>
</ul>
</li>
</ul>
<p>One might, in fact, object that this answer is too long for this format. In my defense, I note that the parent question is addressed in the sections about duplicating effects, and everything else either justifies the direct answer or is relevant in context.</p>
<h2>Shape and contents</h2>
<p>Ultimately, it all comes down to what I like to call the shape-and-contents decomposition. In the simplest possible terms, it means <code>Traversable</code> can be encoded through a class like this:</p>
<pre><code>class (Functor t, Foldable t) =&gt; Fillable t where
    fill :: t () -&gt; [a] -&gt; t a
</code></pre>
<p><code>fill</code> takes a <code>t</code> functorial shape, which we represent here using a <code>t ()</code> value, and fills it with contents drawn from an <code>[a]</code> list. We can rely on <code>Functor</code> and <code>Foldable</code> to give us a conversion in the other direction:</p>
<pre><code>detach :: (Functor t, Foldable t) =&gt; t a -&gt; (t (), [a])
detach = (() &lt;$) &amp;&amp;&amp; toList
</code></pre>
<p>With <code>fill</code> and <code>detach</code>, we can then implement <code>sequenceA</code> in terms of the concrete <code>sequenceA</code> for lists: detach, sequence the list, and then fill:</p>
<pre><code>sequenceFill :: (Fillable t, Applicative f) =&gt; t (f a) -&gt; f (t a)
sequenceFill = uncurry (fmap . fill) . second (sequenceList) . detach

-- The usual sequenceA for lists.
sequenceList :: Applicative f =&gt; [f a] -&gt; f [a]
sequenceList = foldr (liftA2 (:)) (pure [])
</code></pre>
<p>It is also possible, if a little awkward, to define <code>fill</code> in terms of <code>Traversable</code>:</p>
<pre><code>-- Partial, handle with care.
fillTr :: Traversable t =&gt; t () -&gt; [a] -&gt; t a
fillTr = evalState . traverse (const pop)
    where
    pop = state (\(a : as) -&gt; (a, as))
</code></pre>
<p>(For prior art on this approach, see, for instance, <a href="https://stackoverflow.com/a/21083521">this answer</a>.)</p>
<p>In terms of <code>Fillable</code>, the <code>Traversable</code> laws say that <code>fill</code> and <code>detach</code> <em>almost</em> witness the two directions of an isomorphism:</p>
<ol>
<li><p><code>fill</code> must be a left inverse of <code>detach</code>:</p>
<pre><code> uncurry fill . detach = id
</code></pre>
<p>This amounts to the identity law of <code>Traversable</code>.</p>
</li>
<li><p><code>detach</code> must behave as a left inverse of <code>fill</code> as long as <code>fill</code> is only supplied lists and shapes with compatible sizes (otherwise the situation is hopeless):</p>
<pre><code> -- Precondition: length (toList sh) = length as
 detach . uncurry fill $ (sh, as) = (sh, as)
</code></pre>
<p>This property corresponds to the composition law. On its own, it is, in fact, stronger than the composition law. If we assume the identity law, however, it becomes materially equivalent to the composition law. That being so, it is fine to take these properties as an alternate presentation of the <code>Traversable</code> laws, except perhaps if you want to study the composition law in isolation. (There will be a more detailed explanation of this near-equivalence in the second part of the answer, after we look more closely at the composition law.)</p>
</li>
</ol>
<h2>Duplicating effects</h2>
<p>What has all of that to do with your question? Suppose we want to define a traversal that duplicates effects without changing the traversable shape (as changing it would be a flagrant violation of the identity law). Now, assuming that our <code>sequenceA</code> is actually <code>sequenceFill</code>, as defined above, which options do we have? Since <code>sequenceFill</code> piggybacks on <code>sequenceList</code>, which is known to visit each element exactly once, our only hope is to rely on a companion <code>Foldable</code> instance such that <code>toList</code>, and therefore <code>detach</code>, generates a list with duplicated elements. Can we make the <code>Fillable</code> laws hold in such a scenario?</p>
<ul>
<li><p>The first law is not a big problem. In principle, we can always define <code>fill</code> so that it undoes the duplication, discarding the extra copies of elements introduced by <code>detach</code>.</p>
</li>
<li><p>If we have a deduplicating <code>fill</code>, however, the second law is a lost cause. By parametricity, <code>fill</code> can't distinguish between a list with duplicates introduced by <code>detach</code> from any other list we might feed it, and so <code>detach . uncurry fill</code> will always replace some elements with duplicates of other ones.</p>
</li>
</ul>
<p>That being so, a <code>traverseFill</code> that duplicates effects can only arise from an unlawful <code>Fillable</code>. Since the <code>Fillable</code> laws are equivalent to the <code>Traversable</code> ones, we conclude that a lawful <code>Traversable</code> cannot duplicate effects.</p>
<p>(The effect duplication scenario discussed above, by the way, applies to your <code>Bar</code> type: it fails the second <code>Fillable</code> law, and therefore it also fails the <code>Traversable</code> composition law, as your counterexample shows.)</p>
<p>A paper which I really like that covers this question and matters adjacent to it is Bird et al., <a href="https://www.cs.ox.ac.uk/jeremy.gibbons/publications/uitbaf.pdf" rel="nofollow noreferrer"><em>Understanding Idiomatic Traversals Backwards and Forwards</em></a> (2013). Though it might not look like that at first, its approach is closely related to what I have shown here. In particular, its &quot;representation theorem&quot; is essentially the same as the <code>detach</code>/<code>fill</code> relationship explored here, the main difference being that the definitions in the paper are tighter, obviating the need to fuss about what <code>fill</code> is supposed to do when given a list of the wrong length.</p>
<h2>The free applicative presentation</h2>
<p>Though I won't attempt to present the full argument of the Bird et al. paper, in the context of this answer it is worth noting how its proof of the aforementioned representation theorem relies on a formulation of the free applicative functor. We can twist that idea a little to obtain an additional presentation of <code>Traversable</code> in terms of <a href="http://hackage.haskell.org/package/free-5.1.3/docs/Control-Applicative-Free.html" rel="nofollow noreferrer"><code>Ap</code> from <em>free</em>'s <code>Control.Applicative.Free</code></a>:</p>
<pre><code>-- Adapted from Control.Applicative.Free.

data Ap f a where
    Pure :: a -&gt; Ap f a
    Ap   :: f a -&gt; Ap f (a -&gt; b) -&gt; Ap f b

instance Applicative (Ap f) where
  pure = Pure
  Pure f &lt;*&gt; y = fmap f y
  Ap x y &lt;*&gt; z = Ap x (flip &lt;$&gt; y &lt;*&gt; z)

liftAp :: f a -&gt; Ap f a
liftAp x = Ap x (Pure id)

retractAp :: Applicative f =&gt; Ap f a -&gt; f a
retractAp (Pure a) = pure a
retractAp (Ap x y) = x &lt;**&gt; retractAp y
</code></pre>

<pre><code>class (Functor t, Foldable t) =&gt; Batchable t where
    toAp :: t (f a) -&gt; Ap f (t a)

sequenceBatch :: (Batchable t, Applicative f) =&gt; t (f a) -&gt; f (t a)
sequenceBatch = retractAp . toAp

toApTr :: Traversable t =&gt; t (f a) -&gt; Ap f (t a)
toApTr = traverse liftAp
</code></pre>
<p>I'm pretty much sure the following are appropriate laws, though it might be worth it to doublecheck:</p>
<pre><code>retractAp . toAp . fmap Identity . runIdentity = id
toAp . fmap Identity . runIdentity . retractAp = id
</code></pre>
<p>Though this looks far removed from the humble <code>detach</code> and <code>fill</code> combination we started with, it ultimately is just a more precise encoding of the same idea. An <code>Ap f (t a)</code> value is either a single <code>t a</code> structure wrapped in <code>Pure</code>, or a sequence of zero or more <code>f a</code> values (the <code>Ap</code> constructor) capped by a function of the appropriate arity which takes as many <code>a</code>s as there are <code>f a</code>s and produces a <code>t a</code>. In terms of our initial stab at the shape-and-contents decomposition, we have:</p>
<ul>
<li><p>The <code>f a</code>s in the <code>Ap</code> values correspond to the list of contents;</p>
</li>
<li><p>The function (if there is one) encodes which shape to use when reassembling the traversable structure, as well as how it should be filled. The shape-list mismatch problem is neatly avoided at type level, it being statically guaranteed that the function will have the right arity;</p>
</li>
<li><p>As for the effects, <code>retractAp</code> performs the role of combining them in the obvious way, much like <code>sequenceList</code> did in <code>sequenceFill</code>.</p>
</li>
</ul>
<p>(End of part one.)</p>
<h2>Fillable and Traversable, up close</h2>
<p>As promised, part two will start with proving that <code>Fillable</code> really is a presentation of <code>Traversable</code>. In what follows, I will use tweaked versions of the definitions which are easier to manipulate with pen and paper:</p>
<pre><code>-- Making the tuple shuffling implicit. It would have been fine to use
-- the derived Foldable and Traversable. I will refrain from that here
-- only for the sake of explicitness. 
newtype Decomp t a = Decomp { getDecomp :: (t (), [a]) }
    deriving Functor

deriving instance (Show a, Show (t ())) =&gt; Show (Decomp t a)

detach' :: (Functor t, Foldable t) =&gt; t a -&gt; Decomp t a
detach' = Decomp . detach

fill' :: Fillable t =&gt; Decomp t a -&gt; t a
fill' = uncurry fill . getDecomp

-- Sequence the list, then shift the shape into the applicative layer.
-- Also a lawful sequenceA (amounts to Compose ((,) (t ())) []).
sequenceList' :: Applicative f =&gt; Decomp t (f a) -&gt; f (Decomp t a)
sequenceList'
    = fmap Decomp . uncurry (map . (,)) . second sequenceList . getDecomp

instance Traversable Decomp where
    sequenceA = sequenceList'

instance Foldable Decomp where
    foldMap = foldMapDefault

sequenceFill' :: (Fillable t, Applicative f) =&gt; t (f a) -&gt; f (t a)
sequenceFill' = fmap fill' . sequenceList' . detach'
</code></pre>
<p>(By the way, the cleaner definitions above provide a good occasion to note that, if we were to leave the confines of writing actual Haskell, it wouldn't take much to move the shape carried all along the way in <code>sequenceFill'</code> to type level, in effect partitioning the traversable functor according to the possible shapes. As far as I understand it, that would get us well on the way towards the standard dependently typed treatment of containers. I won't delve further into that here; if you feel like exploring, I heartily recommend <a href="https://stackoverflow.com/search?q=user%3A828361+containers">the answers on the topic by Conor McBride (pigworker)</a>.)</p>
<h3>Identity</h3>
<p>We can begin by dealing with the identity law, which is a more straightforward matter:</p>
<pre><code>-- Abbreviations:
I = Identity
uI = runIdentity
C = Compose
uC = getCompose
</code></pre>

<pre><code>-- Goal: Given the identity law...
sequenceFill' @_ @I . fmap I = I
-- ... obtain detach-then-fill:
fill' . detach' = id

sequenceFill' @_ @I . fmap I = I
uI . fmap fill' . sequenceList' @I . detach' . fmap I = id
-- sequenceList is lawful (identity law):
uI . fmap fill' . I . fmap uI . detach' . fmap I = id
uI . fmap fill' . I . detach' . fmap uI . fmap I = id
uI . fmap fill' . I . detach' = id
uI . I . fill' . detach' = id
fill' . detach' = id  -- Goal.
</code></pre>
<p>Since all steps in the derivation above are reversible, we can conclude the detach-then-fill direction of the isomorphism is equivalent to the identity law.</p>
<h3>Composition</h3>
<p>As for the composition law, we might start by using the same strategy:</p>
<pre><code>-- Goal: Given the composition law...
sequenceFill' @_ @(C _ _) . fmap C = C . fmap sequenceFill' . sequenceFill'
-- ... obtain fill-then-detach...
detach' . fill' = id
-- ... within the domain specified by its precondition.

sequenceFill' @_ @(C _ _) . fmap C = C . fmap sequenceFill' . sequenceFill'
fmap fill' . sequenceList' @(C _ _) . detach' . fmap C
    = C . fmap (fmap fill' . sequenceList' . detach')
        . fmap fill' . sequenceList' . detach'
-- LHS
fmap fill' . sequenceList' @(C _ _) . detach' . fmap C
fmap fill' . sequenceList' @(C _ _) . fmap C . detach'
-- sequenceList' is lawful (composition law)
fmap fill' . C . fmap sequenceList' . sequenceList' . detach'
C . fmap (fmap fill') . fmap sequenceList' . sequenceList' . detach'
C . fmap (fmap fill' . sequenceList') . sequenceList' . toList'
-- RHS
C . fmap (fmap fill' . sequenceList' . detach')
    . fmap fill' . sequenceList' . detach'
C . fmap (fmap fill' . sequenceList') . fmap (detach' . fill') 
    . sequenceList' . detach'
-- LHS = RHS
C . fmap (fmap fill' . sequenceList') . sequenceList' . detach'
    = C . fmap (fmap fill' . sequenceList') . fmap (detach' . fill') 
        . sequenceList' . detach'
-- C is injective:
fmap (fmap fill' . sequenceList') . sequenceList' . detach'
    = fmap (fmap fill' . sequenceList') . fmap (detach' . fill')
        . sequenceList' . detach'  -- On hold.
</code></pre>
<p>At this point, it appears we are stuck with a property weaker than the <code>detach' . fill' = id</code> we expected to uncover. On the upside, there are a few nice things about it:</p>
<ul>
<li><p>All steps in the derivation above are reversible, so the property is equivalent to the composition law.</p>
</li>
<li><p>The <code>sequenceList' . detach'</code> and <code>fmap (fmap fill' . sequenceList')</code> extra terms that pad both sides of the equation make it so that every <code>fill'</code> is preceded by a <code>detach'</code>, and every <code>detach'</code> is followed by a <code>fill'</code>. That means the precondition of the fill-then-detach law automatically holds.</p>
</li>
<li><p>The fill-then-detach law is strictly stronger than this property. That being so, if <code>detach' . fill' = id</code> (within the bounds of the precondition, etc.) then this property, and therefore the composition law, also holds.</p>
</li>
</ul>
<p>I will get back to these observations in a little while in order to justify my earlier claim that <code>detach' . fill' = id</code> can be regarded as a <code>Traversable</code> law.</p>
<h3>Idempotency</h3>
<p>A short break, before we carry on with our regular schedule. There is a little piece of trivia we can uncover by specialising both applicative functors in the composition law to <code>Identity</code>. Continuing from where we stopped:</p>
<pre><code>fmap (fmap fill' . sequenceList') . sequenceList' . detach'
    = fmap (fmap fill' . sequenceList') . fmap (detach' . fill')
        . sequenceList' . detach'
-- In particular:
fmap (fmap fill' . sequenceList' @I) . sequenceList' @I . detach'
    = fmap (fmap fill' . sequenceList' @I) . fmap (detach' . fill') 
        . sequenceList' @I . detach'
-- sequenceList' is lawful (identity):
fmap (fmap fill' . I . fmap uI) . I . fmap uI . detach'
    = fmap (fmap fill' . I . fmap uI) . fmap (detach' . fill') . I
        . fmap uI . detach'
-- shift the I leftwards, and the uI rightwards, on both sides:
I . I . fill' . detach' . fmap uI . fmap uI
    = I . I . fill' . detach' . fill' . detach' . fmap uI . fmap uI
-- I is injective, and fmap uI is surjective:
fill' . detach' = fill' . detach' . fill' . detach'
</code></pre>
<p>We end up with an idempotency property for <code>fill' . detach'</code>, and, indirectly, also for <code>sequenceA</code>. Though such a property is unsurprising as far as <code>Traversable</code> is concerned, as it follows immediately from the identity law, it is rather interesting that it also follows from the composition law on its own. (On a related note, I sometimes wonder if we could get any mileage out of a <code>Semitraversable</code> class of sorts, which would only have the composition law.)</p>
<h2>Duplicating effects: once more, with feeling</h2>
<p>Now it is a good time to revisit your original question: exactly why duplication of effects causes trouble with the laws? The <code>Fillable</code> presentation helps to clarify the connection. Let's have another look at both sides of the composition law, in the form we have just given it:</p>
<pre><code>    fmap (fmap fill' . sequenceList') 
        . sequenceList' . detach'  -- LHS

    fmap (fmap fill' . sequenceList') 
        . fmap (detach' . fill') 
        . sequenceList' . detach'  -- RHS
</code></pre>
<p>Let's assume the identity law holds. In that case, the only possible source of duplicated effects in <code>sequenceFill'</code> are elements being duplicated by <code>detach'</code> (as <code>sequenceList'</code> doesn't duplicate, and <code>fill'</code> can't duplicate because of the identity law).</p>
<p>Now, if <code>detach'</code> introduces duplicates at certain positions, <code>fill'</code> must remove them so that the identity law holds. Thanks to parametricity, however, elements at those positions will be always removed, even if the relevant elements aren't actually duplicated because the list wasn't created by <code>detach'</code>. To put it in another way, there is a precondition for <code>fill'</code> being an innocuous removal of duplicates, namely, that it must be given lists that might have been produced by <code>detach'</code>. In the composition law, it might happen, depending on what the applicative effect is, that the first <code>sequenceList'</code> produces lists that fall outside of this precondition. In that case, the <code>fmap fill'</code> that follows it on the right hand side will eliminate inner effects (keep in mind the first <code>sequenceList'</code> only deals with the outer applicative layer) that weren't actually duplicated, the difference will be duly detected by the second <code>sequenceList' . detach'</code>, which acts on the inner effect layer, and we'll end up with a law violation.</p>
<p>In fact, we can affirm something stronger: if <code>sequenceFill'</code> duplicates effects, it is <em>always</em> possible to violate the law in the manner described above. All we need for such a claim is a good enough counterexample:</p>
<pre><code>advance :: State (Const (Sum Natural) x) (Const (Sum Natural) x)
advance = get &lt;* modify (+1)
</code></pre>
<p>The trick is that if you sequence a list that only contains copies of <code>advance</code>, the list you'll be given back is guaranteed not to have any duplicated <code>Const (Sum Natural)</code> effects:</p>
<pre><code>GHCi&gt; flip evalState 0 $ sequenceA (replicate 3 advance)
[Const (Sum {getSum = 0}),Const (Sum {getSum = 1}),Const (Sum {getSum = 2})]
</code></pre>
<p>That being so, if such a list reaches a <code>sequenceFill'</code> implementation that duplicates effects, the <code>fmap fill'</code> in it will invariably discard non-duplicates:</p>
<pre><code>data Bar a = Bar a
    deriving (Show, Functor)

instance Foldable Bar where
    foldMap f (Bar x) = f x &lt;&gt; f x

-- This corresponds to your Traversable instance.
instance Fillable Bar where
    fill (Decomp (_, [x, y])) = Bar y
</code></pre>

<pre><code>GHCi&gt; flip evalState 0 &lt;$&gt; (advance &lt;$ Bar ())
Bar (Const (Sum {getSum = 0}))
GHCi&gt; flip evalState 0 &lt;$&gt; detach' (advance &lt;$ Bar ())
Decomp {getDecomp = (Bar (),[Const (Sum {getSum = 0}),Const (Sum {getSum = 0})])}
GHCi&gt; flip evalState 0 $ (sequenceList' . detach') (advance &lt;$ Bar ())
Decomp {getDecomp = (Bar (),[Const (Sum {getSum = 0}),Const (Sum {getSum = 1})])}
GHCi&gt; flip evalState 0 $ (fmap fill' . sequenceList' . detach') (advance &lt;$ Bar ())
Bar (Const (Sum {getSum = 1}))
</code></pre>
<p>A violation is now inevitable:</p>
<pre><code>GHCi&gt; lhs = fmap (fmap fill' . sequenceList') . sequenceList' . detach'
GHCi&gt; rhs = fmap (fmap fill' . sequenceList') . fmap (detach' . fill') . sequenceList' . detach'
GHCi&gt; flip evalState 0 $ lhs (advance &lt;$ Bar ())
Const (Sum {getSum = 1})
GHCi&gt; flip evalState 0 $ rhs (advance &lt;$ Bar ())
Const (Sum {getSum = 2})
</code></pre>
<p>(<code>advance</code>, as you might have noted, is very similar to the counterexample in <a href="https://stackoverflow.com/a/61195551">your answer</a>, only tweaked so that it can be used with arbitrary traversable-like structures.)</p>
<p>This suffices to show that duplication of effects is incompatible with the composition law.</p>
<h3>Simplifying the composition law</h3>
<p>At this point, there is a convenient way to justify why we can use the simplified fill-then-detach property...</p>
<pre><code>-- Precondition: length (toList sh) = length as
detach' . fill' $ (sh, as) = (sh, as)
</code></pre>
<p>... in lieu of the bulkier composition law we have been dealing with in the last few sections. Again, assume the identity law holds. In that case, we can classify the possible implementations of <code>detach'</code> in two cases:</p>
<ol>
<li><p><code>detach'</code> never duplicates elements. As a consequence, <code>detach'</code> is, within the limits of the fill-then-detach precondition, surjective (for instance, if the traversable functor is a vector of length six, <code>detach'</code> can generate all possible lists of length six, though it won't generate lists with other lengths). If a function that has a left inverse is surjective, though, its left inverse is also a right inverse. Therefore, <code>detach' . fill' = id</code> within the bounds of the precondition, and the composition law holds.</p>
<p>(The &quot;within the limits of the fill-then-detach precondition&quot; bit might feel like handwaving, but I believe it can be made rigorous by using dependent types to partition the traversable functor type according to the shapes, in the way I alluded at the beginning of the second part.)</p>
</li>
<li><p><code>detach'</code> duplicates elements. In that case, though, the ensuing duplication of effects means the composition law won't hold, as we have just shown, and neither will the stronger <code>detach' . fill' = id</code> property.</p>
</li>
</ol>
<p>That being so, the the <code>Traversable</code> composition law and the <code>Fillable</code> fill-then-detach law always agree as long as the identity law holds; the difference between them can only show up in implementations that violate the identity law. Therefore, if taken together, the <code>Fillable</code> laws as stated in the first part of the answer are equivalent to the <code>Traversable</code> ones.</p>
<h2>foldMapDefault and the other naturality law</h2>
<p>A beautiful feature of the <code>Fillable</code> presentation is how it makes it explicit that the only free choice we have in defining a lawful <code>sequenceA</code> is that of the order in which the effects will be sequenced. Once a certain order is chosen by picking a <code>Foldable</code> implementation, which determines <code>toList</code> and <code>detach'</code>, <code>sequenceList'</code> must follow that order upon sequencing the effects. Furthermore, since <code>fill'</code> is (within the bounds of the fill-then-detach precondition) a full inverse of <code>detach'</code>, it is uniquely determined.</p>
<p>The class hierarchy we have in the base libraries is not arranged in quite the same way as <code>Fillable</code>: the real <code>sequenceA</code> is a self-sufficient method of <code>Traversable</code> which, unlike <code>sequenceFill'</code>, does not rely on <code>Foldable</code> for its implementation. Rather, the connection between <code>Foldable</code> and <code>Traversable</code> is straightened out by a superclass coherence law:</p>
<pre><code>-- Given:
foldMapDefault :: (Traversable t, Monoid m) =&gt; (a -&gt; m) -&gt; t a -&gt; m
foldMapDefault f = getConst . traverse (Const . f)

foldMapDefault = foldMap
</code></pre>
<p>(There is an analogous property for <code>Functor</code> and <code>fmapDefault</code>, but parametricity means it follows from the identity law.)</p>
<p>In terms of <code>toList</code> and <code>sequenceA</code>, this law becomes:</p>
<pre><code>toList = getConst . sequenceA . fmap (Const . (:[]))
</code></pre>
<p>If we use <code>sequenceA = sequenceFill'</code> to bring us back to the <code>Fillable</code> presentation...</p>
<pre><code>getConst . fmap fill' . sequenceList' . detach' . fmap (Const . (:[]))
getConst . fmap fill' . sequenceList' . fmap (Const . (:[])) . detach'
-- fmap @(Const _) doesn't do anything:
getConst . sequenceList' . fmap (Const . (:[])) . detach'
-- sequenceList' is lawful (foldMapDefault law):
toList @(Detach _) . detach'
snd . getDecomp . detach'
toList
</code></pre>
<p>... we conclude that the <code>foldMapDefault</code> law holds automatically.</p>
<h3>Bird et al.'s &quot;'naturality' in the datatype&quot;</h3>
<p>After the identity and composition laws, the third best known law of <code>Traversable</code> is naturality in the applicative functor, often referred to simply as the naturality law:</p>
<pre><code>-- Precondition: h is an applicative homomorphism, that is:
-- h (pure a) = pure a
-- h (u &lt;*&gt; v) = h u &lt;*&gt; h v
h . sequenceA = sequenceA . fmap h
</code></pre>
<p>While useful, as well as significant theory-wise (it reflects an alternative view of <code>sequenceA</code> as a natural transformation in the category of applicative functors and applicative homomorphisms, discussed for instance in Jaskelioff and Rypacek, <a href="https://arxiv.org/pdf/1202.2919.pdf" rel="nofollow noreferrer"><em>An Investigation of the Laws of Traversals</em></a>), the naturality law follows from a free theorem for <code>sequenceA</code> (in the vein of Voigtländer, <a href="https://www.cs.tufts.edu/%7Enr/cs257/archive/janis-voigtlaender/free-thm-classes.pdf" rel="nofollow noreferrer"><em>Free Theorems Involving Constructor Classes</em></a>), and so there isn't much to say about it in the context of this answer.</p>
<p>The Bird et al. paper mentioned in the first part discusses, in section 6, a different naturality property, which the authors call &quot;'naturality' in the datatype&quot;. Unlike the better known naturality law, it is a naturality property for the traversable functor itself:</p>
<pre><code>-- Precondition: r preserves toList, that is
-- toList . r = toList
fmap r . sequenceA = sequenceA . r
</code></pre>
<p>(Bird et al. don't use <code>Foldable</code> explictly, rather stating the property in terms of <code>contents = getConst . traverse (Const . (:[])</code>. Assuming the <code>foldMapDefault</code> coherence law holds, there is no difference.)</p>
<p>The <code>Fillable</code> perspective suits this naturality property very nicely. We can begin by noting we can lift a natural transformation on some functor <code>t</code> to work on <code>Decomp t</code> as well:</p>
<pre><code>-- Decomp as a higher-order functor.
hmapDecomp :: (forall x. t x -&gt; u x) -&gt; Decomp t a -&gt; Decomp u a
hmapDecomp r (Decomp (sh, as)) = Decomp (r sh, as)
</code></pre>
<p>If <code>r</code> preserves <code>toList</code> (or, we might even say, if it is a foldable homomorphism), it follows that it also preserves <code>detach'</code>, and vice-versa:</p>
<pre><code>-- Equivalent to toList . r = toList
hmapDecomp r . detach' = detach' . r'
</code></pre>
<p>(<code>hmapDecomp</code> doesn't affect the list of contents, and, being a natural transformation, <code>r</code> commutes with the <code>(() &lt;$)</code> half of <code>detach'</code>.)</p>
<p>If we further assume the <code>Fillable</code> laws, we can use the fact that <code>fill'</code> and <code>detach'</code> are inverses (within the bounds of the precondition of the fill-then-detach law) to shift <code>r</code> from <code>detach'</code> to <code>fill'</code>:</p>
<pre><code>hmapDecomp r . detach' = detach' . r
hmapDecomp r . detach' . fill' = detach' . r . fill'
hmapDecomp r = detach' . r . fill'
fill' . hmapDecomp r = fill' . detach' . r . fill'
fill' . hmapDecomp r = r . fill'
</code></pre>
<p>That is, applying <code>r</code> to the shape and then filling it is the same as filling and then applying <code>r</code> to the filled shape.</p>
<p>At this point, we can work our way back to <code>sequenceFill'</code>:</p>
<pre><code>fill' . hmapDecomp r = r . fill'
fmap (fill' . hmapDecomp r) = fmap (r . fill')
fmap (fill' . hmapDecomp r) . sequenceList' . detach'
    = fmap (r . fill') . sequenceList' . detach'
-- LHS
fmap (fill' . hmapDecomp r) . sequenceList' . detach'
-- sequenceList' only changes the list, and `hmapDecomp` r only the shape.
fmap fill' . sequenceList' . hmapDecomp r . detach'
-- r is a foldable homomorphism.
fmap fill' . sequenceList' . detach' . r
sequenceFill' . r
-- RHS
fmap (r . fill') . sequenceList' . detach'
fmap r . sequenceFill'
-- LHS = RHS
fmap r . sequenceFill' = sequenceFill' . r
</code></pre>
<p>We have thus obtained the naturality in the traversable functor property, as might have been expected given the equivalence between the <code>Fillable</code> and <code>Traversable</code> laws. Still, we did learn something in the process. Bird et al. were justified in being cautious with the word &quot;naturality&quot; when talking of this property, as the restriction to <code>toList</code>-preserving natural transformations seems extraneous in the context of the standard class hierarchy. From the <code>Fillable</code> perspective, though, <code>fill'</code> is determined by our choice of <code>Foldable</code> instance, and so the property is about as sharp as any other naturality property for a constructor class. That being so, I believe we can drop the scare quotes around &quot;naturality&quot;.</p>
<h2>Executive summary: dos and don'ts of Traversable</h2>
<p>We are now in a position to make a fairly complete list of the consequences of the <code>Traversable</code> laws. Though there is no real difference, I will speak here in terms of <code>traverse</code>, as using it instead of <code>sequenceA</code> makes it a little clearer what is meant by &quot;elements&quot;, in contrast with &quot;effects&quot;.</p>
<p>A lawful <code>traverse</code> <strong>must not</strong>:</p>
<ul>
<li><p><strong>Change the traversable shape</strong> in any way, due to the identity law.</p>
<ul>
<li>If the change is idempotent, the identity law will still be violated, but the composition law might hold.</li>
</ul>
</li>
<li><p><strong>Drop or duplicate elements</strong>, due to the identity law.</p>
<ul>
<li>In particular, that isn't allowed even if the shape is left unchanged by overwriting some of the elements with others.</li>
</ul>
</li>
<li><p><strong>Reorder elements</strong> in the traversable structure, due to the identity law.</p>
</li>
<li><p><strong>Duplicate effects</strong>, even if there is no duplication of elements, due to the composition law.</p>
</li>
</ul>
<p>A lawful <code>traverse</code> <strong>may</strong>:</p>
<ul>
<li><strong>Reorder effects</strong>, that is, sequence effects in a different order than that of elements in the original traversable structure.
<ul>
<li>The order of effects can even depend on the individual shape of the structure.</li>
</ul>
</li>
</ul>
<p>A lawful <code>traverse</code> <strong>must</strong>:</p>
<ul>
<li><strong>Sequence effects in the order given by <code>toList</code></strong> from the <code>Foldable</code> instance for the type, due to the <code>foldMapDefault</code> law.</li>
</ul>
<p>A lawful <code>traverse</code> <strong>will</strong>:</p>
<ul>
<li><p><strong>Preserve applicative homomorphisms</strong>, that is, natural transformations that preserve <code>pure</code> and <code>return</code>, due to the naturality law, which holds freely.</p>
</li>
<li><p><strong>Preserve foldable homomorphisms</strong>, that is, natural transformations that preserve <code>toList</code>/<code>foldMap</code>, due to the naturality-in-the-traversable law, which follows from the identity and composition laws.</p>
</li>
</ul>
Why can't a Traversable visit its elements more than once?
<p>I remember reading somewhere that a type like this one can't be <code>Traversable</code>:</p>

<pre><code>data Bar a = Bar a deriving(Show)

instance Functor Bar where
  fmap f (Bar x) = Bar (f x)

instance Foldable Bar where
  foldMap f (Bar x) = f x &lt;&gt; f x
</code></pre>

<p>The bit of the explanation I remember is that for <code>foldMap = foldMapDefault</code> to hold, the <code>Traversable</code> instance would have to visit its elements more than once, which a lawful instance can't do. However, I don't remember why a lawful instance can't do that. Consider this one:</p>

<pre><code>instance Traversable Bar where
  sequenceA (Bar x) = Bar &lt;$ x &lt;*&gt; x
</code></pre>

<p>It looks fine at first glance. What's unlawful about doing that?</p>