<p dir="ltr">+= carries expectation of specific behavioural properties in popular circles, making it a devious moniker. In an attempt to bridge programming paradigms with Haskell this problem is common. There be dragons here: Always question your assumptions about familiar names and symbols. </p>
<div class="gmail_quote">On 2013-05-24 11:15 AM, "Brent Yorgey" <<a href="mailto:byorgey@seas.upenn.edu">byorgey@seas.upenn.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, May 24, 2013 at 06:41:27PM +0200, Giacomo Tesio wrote:<br>
> For example I'm scared by += a function compositions.<br>
><br>
> For example here<br>
><br>
> units.traversed.health -= 3<br>
><br>
><br>
> (from<br>
> <a href="http://www.haskellforall.com/2013/05/program-imperatively-using-haskell.html" target="_blank">http://www.haskellforall.com/2013/05/program-imperatively-using-haskell.html</a>)<br>
> I've some difficult to grasp the type. I can calculate it (or ask ghci :-D)<br>
> , but it looks complex to grasp.<br>
><br>
> May be I'm just too new to Haskell tools... but... I fear that in the long<br>
> run, this could become unreadable.<br>
<br>
You could already do exactly the same thing without the lens package.<br>
It uses the State monad. The lens package just makes it much simpler<br>
to write this code.<br>
<br>
If you think that overuse of the State monad will lead to bad,<br>
unmaintainable code, you are right. But that has nothing to do with<br>
lenses.<br>
<br>
Lenses can also be used in many contexts which do not involve the<br>
State monad.<br>
<br>
-Brent<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div>