[erlang-questions] Updates, lenses, and why cross-module inlining would be nice
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Thu Nov 26 17:36:06 CET 2015
On Thu, Nov 26, 2015 at 5:00 PM, Dan Gudmundsson <dangud@REDACTED> wrote:
> Maybe a stupid question I have not looked at lenses before
> but why include the "path of keys" into the lens?
My guess is that requiring a Key breaks some trivial lenses, or adds some
complexity to the proofs. You can create an identity lens for instance:
lens_id() ->
{fun(X) -> X end, fun(A, _X) -> A, ...}.
which should obey the lens laws. Furthermore it composes as an identity
does, i.e.
compose(ID, Lens) == Lens
compose(Lens, ID) == Lens
It could be, I haven't really checked, that the requirement of a Key poses
additional complexity here. Lenses stems from languages which have
currying, so you can simply partially apply the key to obtain the closure
which can process that Key. By doing so, the Key kind-of gets out of the
way, which probably makes identities as the above fall out nicer in the
logic, and currying can be used to elegantly "hide" the fact that there are
keys in there over which we have built a closure.
--
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151126/ad90c360/attachment.htm>
More information about the erlang-questions
mailing list