provide and add docs
This commit is contained in:
parent
0b02692350
commit
5c413bd1b3
unstable/lens
23
unstable/lens/define-nested.scrbl
Normal file
23
unstable/lens/define-nested.scrbl
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#lang scribble/manual
|
||||||
|
|
||||||
|
@(require lens/private/doc-util/main)
|
||||||
|
|
||||||
|
@title{Lenses for nested data}
|
||||||
|
|
||||||
|
@defmodule[unstable/lens/define-nested]
|
||||||
|
|
||||||
|
@defform[(define-nested-lenses [base-id base-lens-expr] clause ...)
|
||||||
|
#:grammar ([clause [sub-id sub-lens-expr]])]{
|
||||||
|
A shorthand for defining composed lenses for nested data structures.
|
||||||
|
|
||||||
|
For example, if there is a @racket[top] struct containing a
|
||||||
|
@racket[middle] struct, which contains an @racket[x] field and a
|
||||||
|
@racket[y] field, a form like:
|
||||||
|
@(racketblock
|
||||||
|
(define-nested-lenses [top-middle top-middle-lens]
|
||||||
|
[x middle-x-lens]
|
||||||
|
[y middle-y-lens]))
|
||||||
|
Will define @racket[top-middle-x-lens] and @racket[top-middle-y-lens]
|
||||||
|
as @racket[(lens-thrush top-middle-lens middle-x-lens)] and
|
||||||
|
@racket[(lens-thrush top-middle-lens middle-y-lens)].
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
#lang reprovide
|
#lang reprovide
|
||||||
"arrow.rkt"
|
"arrow.rkt"
|
||||||
|
"define-nested.rkt"
|
||||||
"dict-nested.rkt"
|
"dict-nested.rkt"
|
||||||
"hash-filterer.rkt"
|
"hash-filterer.rkt"
|
||||||
"if.rkt"
|
"if.rkt"
|
||||||
|
|
|
@ -13,6 +13,7 @@ this library being backwards-compatible.
|
||||||
|
|
||||||
@(include-sections
|
@(include-sections
|
||||||
"arrow.scrbl"
|
"arrow.scrbl"
|
||||||
|
"define-nested.scrbl"
|
||||||
"dict-nested.scrbl"
|
"dict-nested.scrbl"
|
||||||
"hash-filterer.scrbl"
|
"hash-filterer.scrbl"
|
||||||
"if.scrbl"
|
"if.scrbl"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user