Heimdell / elm-optics

A faithful for of `lens` to Elm
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Comparison to elm-monocle #1

Open MartinSStewart opened 3 years ago

MartinSStewart commented 3 years ago

Hi, I briefly looked at your package and it seems to be quite similar to https://package.elm-lang.org/packages/arturopala/elm-monocle/latest/. To help people decide which package to use, maybe your readme could have a quick explanation for why or why not to use your package over elm-monocle?

Heimdell commented 3 years ago

The elm-monocle is mono-morphic: it doesn't allow to change the type of parts and the type of the whole. It also does not allow for different kinds of optics to be composed with the same operator.

My library provides polymorphic optics (see each), and thus allows to change type of the updated object.

Also, my library provides 1 (one) compositional operator o for all kinds of optics. So, no Compose.traversalWithLens, just o.

On the CONS side, my library requires you to drag an additional type variable when you define an optical thingy and if you write a function that accepts some optics and you have to use its capabilities, you have to designate that by replacing the variable with Y in that function.