<div dir="ltr">I see fmap as a &quot;penetration&quot; of one box.<br>fmap.fmap as a &quot;penetration&quot; of two boxes, and so on.<br><br>So, if you have (UI -&gt; Behavior (Blah, a)), then the value &quot;a&quot; is &quot;buried&quot; inside a (UI-&gt;) box, then inside a Behavior box, and then inside a (Blah,) box.<br>
To change the value of &quot;a&quot; you can thus use:&nbsp; (fmap.fmap.fmap) aToB<br><br>To access (Blah, a), instead, just use (fmap.fmap) and penetrate just 2 boxes instead of 3.<br><br>Additionally, this &quot;trick&quot; also works nicely with liftA2.&nbsp; If you have two values that are buried inside the same 2 boxes (For example,&nbsp; two values of type: UI -&gt; Behavior a -- the boxes here are a (UI-&gt;) reader, and a Behavior), then you can apply f to the &quot;a&quot; inside both via:<br>
<br>(liftA2.liftA2) f doublyBoxedA doublyBoxedB<br><br>And as usual, (liftA2.liftA2.liftA2) when the values are wrapped in 3 boxes, and so on.<br><br>Eyal<br><br><div class="gmail_quote">2008/11/19 Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com">bugfact@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Many of the fmap fmaps I&#39;ve seen come from<div><br></div><div><span style="font-family: &#39;courier new&#39;; font-size: 16px;">(fmap f) . g = (fmap f) `fmap` g = fmap (fmap f) g = (fmap (fmap f)) g = ((fmap.fmap) f) g = (fmap.fmap) f g</span><br>

</div><div><br></div><div>But... to me the former is much clearer than the latter... It is less abstract since it uses (.) instead of fmap.</div><div><br></div><div>However, I also see (fmap.fmap.fmap), so Conal must have seen a pattern here?&nbsp;</div>

<div><br></div><div>Of course one could also write (fmap `fmap` fmap `fmap` fmap) instead of (fmap.fmap.fmap).</div><div><br></div><div>Or as was already mentioned&nbsp;&nbsp;with the generic replacement (.) = fmap, (fmap.fmap.fmap) can be written as ( (.) . (.) . (.) )</div>

<div><br></div><div>But besides this all being very Haskelly Hackery - and maybe ASCII art that needs to be censured - I don&#39;t see the light yet :)</div><div>&nbsp;</div><div>Could somebody enlighten me?</div><div><br></div>

<div>&nbsp;</div><div><br></div><div><br></div><div><br></div><div><div><br></div><div><br><div><div><br></div></div></div></div>
<br>_______________________________________________<br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
<br></blockquote></div><br></div>