Monocle
Monocle copied to clipboard
Renaming optics type parameters
The traditional STAB naming of type parameters is obscure and a barrier to learning.
Proposed new names:
PLens[SourceIn, SourceOut, TargetOut, TargetIn]
Lens[Source, Target]
to be applied consistently across all code.
Question: what should we do about short variable names or lambda arguments, where we normally would use s
, t
, a
or b
? si
, so
, to
, ti
? sIn
, etc?
Great idea, we should document whatever we decide for argument naming convient in a contributor.md
My vote go for: source
, target
if there is no ambiguity. Otherwise, sourceIn
, sourceOut
, targetIn
, targetOut
.
I also prefer update
for TargetIn => TargetOut
or TargetIn => F[TargetOut]
and predicate
for Target => Boolean
BTW, I think it should be PLens[SourceIn, SourceOut, TargetIn, TargetOut]
(last two type parameters swapped)