You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v2/optics/README.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,7 +221,7 @@ Lenses can be automatically generated using the `fp-go` CLI tool and a simple an
221
221
1.**Annotate your struct** with the `fp-go:Lens` comment:
222
222
223
223
```go
224
-
//go:generate go run github.com/IBM/fp-go/v2/main.go lens --dir . --filename gen_lens.go
224
+
//go:generate go run github.com/IBM/fp-go/v2 lens --dir . --filename gen_lens.go
225
225
226
226
// fp-go:Lens
227
227
typePersonstruct {
@@ -293,13 +293,23 @@ More specific optics can be converted to more general ones.
293
293
294
294
## 📦 Package Structure
295
295
296
+
### Core Optics
296
297
-**[optics/lens](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/lens)**: Lenses for product types (structs)
297
298
-**[optics/prism](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/prism)**: Prisms for sum types ([`Either`](https://pkg.go.dev/github.com/IBM/fp-go/v2/either), [`Result`](https://pkg.go.dev/github.com/IBM/fp-go/v2/result), etc.)
298
299
-**[optics/iso](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/iso)**: Isomorphisms for equivalent types
299
300
-**[optics/optional](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/optional)**: Optional optics for maybe values
300
301
-**[optics/traversal](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/traversal)**: Traversals for multiple values
301
302
302
-
Each package includes specialized sub-packages for common patterns:
303
+
### Utilities
304
+
-**[optics/builder](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/builder)**: Builder pattern for constructing complex optics
305
+
-**[optics/codec](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/codec)**: Type-safe encoding/decoding with validation
306
+
- Provides `Type[A, O, I]` for bidirectional transformations with validation
307
+
- Includes codecs for primitives (String, Int, Bool), collections (Array), and sum types (Either)
308
+
- Supports refinement types and codec composition via `Pipe`
309
+
- Integrates validation errors with context tracking
310
+
311
+
### Specialized Sub-packages
312
+
Each core optics package includes specialized sub-packages for common patterns:
303
313
-**array**: Optics for arrays/slices
304
314
-**either**: Optics for [`Either`](https://pkg.go.dev/github.com/IBM/fp-go/v2/either) types
305
315
-**option**: Optics for [`Option`](https://pkg.go.dev/github.com/IBM/fp-go/v2/option) types
0 commit comments