[Chart] data-accessor, lens, and Chart

Ben Gamari bgamari.foss at gmail.com
Sat Mar 23 19:20:34 GMT 2013


Malcolm Wallace <malcolm.wallace at me.com> writes:

> Well, I have my own DSL for creating charts, which eventually gets translated into the kind of stuff you have below, or native records, or whatever.  I don't much mind what the lower layer consists of, because in my world, I write:
>
>   linePointPlot [(2,3),(4,10),(5,105),(6,2013)]
>       |+| Title "Log/Linear example"
>       |+| XAxisLabel "horizontal"
>       |+| YAxisLabel "vertical"
>       |+| YAxisLogScale
>
> I find I can never understand nor remember the subtle differences
> between ^: and ^= and ^. so writing code with data-accessor is rather
> hit-and-miss - I just keep trying operators until it compiles.  Since
> the lens package has the reputation for introducing 99 different
> operators, I'm not encouraged to learn it either.  I much prefer the
> restricted world of a single operator.  :-)
>
I've actually found that lens is much more consistent than
data-accessor. Really all you need to know is (.) for composition and (.~)
for setting. It's really much better than data-accessor and only
slightly worse than your operators.

Cheers,

 - Ben



More information about the Chart mailing list