Flipped function application

Daniel Trstenjak daniel.trstenjak
Fri Oct 11 10:34:43 UTC 2013


> A year ago, I might have opposed the proposal altogether, but
> diagrams has convinced me that it's quite useful.

It's almost the same for myself. I thought that I should dislike the
lens library, but after being able to write code like this:

 grid & atCoord oldCoord . entity .~ NoEntity
      & atCoord newCoord . entity .~ RobotEntity rob


And I think it would read even better like this:

 grid # atCoord oldCoord . entity .= NoEntity
      # atCoord newCoord . entity .= RobotEntity rob


Yes, having to use '~' instead of '=' is the thing that currently
bothers me the most about the lens library, because IMHO the usage in
the State-Monad should be the lesser used one, should be the less
encouraged one, and the "nicer" operator should be reserved for the
more common case.

Being able to use '.=' in the State-Monad seems mostly to be nice for
writing tutorials =).


Greetings,
Daniel




More information about the Libraries mailing list