Skip to content

Commit eafc008

Browse files
committed
fix: doc for lens generation
Signed-off-by: Dr. Carsten Leue <[email protected]>
1 parent 46bf065 commit eafc008

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

v2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func process() IOResult[string] {
465465
- **ReaderIOResult** - Combine Reader, IO, and Result for complex workflows
466466
- **Array** - Functional array operations
467467
- **Record** - Functional record/map operations
468-
- **Optics** - Lens, Prism, Optional, and Traversal for immutable updates
468+
- **[Optics](./optics/README.md)** - Lens, Prism, Optional, and Traversal for immutable updates
469469

470470
#### Idiomatic Packages (Tuple-based, High Performance)
471471
- **idiomatic/option** - Option monad using native Go `(value, bool)` tuples

v2/optics/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Lenses can be automatically generated using the `fp-go` CLI tool and a simple an
221221
1. **Annotate your struct** with the `fp-go:Lens` comment:
222222

223223
```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
225225

226226
// fp-go:Lens
227227
type Person struct {
@@ -293,13 +293,23 @@ More specific optics can be converted to more general ones.
293293

294294
## 📦 Package Structure
295295

296+
### Core Optics
296297
- **[optics/lens](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/lens)**: Lenses for product types (structs)
297298
- **[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.)
298299
- **[optics/iso](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/iso)**: Isomorphisms for equivalent types
299300
- **[optics/optional](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/optional)**: Optional optics for maybe values
300301
- **[optics/traversal](https://pkg.go.dev/github.com/IBM/fp-go/v2/optics/traversal)**: Traversals for multiple values
301302

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:
303313
- **array**: Optics for arrays/slices
304314
- **either**: Optics for [`Either`](https://pkg.go.dev/github.com/IBM/fp-go/v2/either) types
305315
- **option**: Optics for [`Option`](https://pkg.go.dev/github.com/IBM/fp-go/v2/option) types

0 commit comments

Comments
 (0)