Skip to content

Implement Map function for lazy values#4

Merged
anish749 merged 2 commits intomainfrom
claude/add-lazy-map-function-011TtkvPf9GaBKhWSrVzgaMv
Dec 8, 2025
Merged

Implement Map function for lazy values#4
anish749 merged 2 commits intomainfrom
claude/add-lazy-map-function-011TtkvPf9GaBKhWSrVzgaMv

Conversation

@anish749
Copy link
Owner

@anish749 anish749 commented Dec 7, 2025

Map transforms Lazy[T, E] to Lazy[U, E] by applying a function to the value. FlatMap enables monadic composition by flattening nested lazy values.

Both functions:

  • Maintain laziness (transformation only happens on Get())
  • Properly propagate errors from the source lazy
  • Support concurrent access via the existing sync.Once mechanism
  • Handle typed nil errors correctly using reflection

Map transforms Lazy[T, E] to Lazy[U, E] by applying a function to the value.
FlatMap enables monadic composition by flattening nested lazy values.

Both functions:
- Maintain laziness (transformation only happens on Get())
- Properly propagate errors from the source lazy
- Support concurrent access via the existing sync.Once mechanism
- Handle typed nil errors correctly using reflection
- Replace lambda wrappers with direct strconv.Itoa references (unlambda)
- Reorder struct fields for better memory alignment (fieldalignment)
@anish749 anish749 merged commit 6a2fa18 into main Dec 8, 2025
19 of 20 checks passed
@anish749 anish749 deleted the claude/add-lazy-map-function-011TtkvPf9GaBKhWSrVzgaMv branch December 8, 2025 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants