Monocle icon indicating copy to clipboard operation
Monocle copied to clipboard

Renaming optics type parameters

Open kenbot opened this issue 4 years ago • 1 comments

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?

kenbot avatar Feb 11 '21 00:02 kenbot

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)

julien-truffaut avatar Feb 11 '21 09:02 julien-truffaut