1#[fp_macros::document_module]
20mod inner {
21 use {
22 crate::{
23 classes::*,
24 kinds::*,
25 },
26 fp_macros::*,
27 };
28
29 #[document_examples]
46 #[kind(type Of<'a, A: 'a, B: 'a>: 'a;)]
98 pub trait RefBitraversable: RefBifunctor + RefBifoldable {
99 #[document_signature]
104 #[document_type_parameters(
106 "The lifetime of the values.",
107 "The brand of the cloneable function wrapper.",
108 "The type of the first-position elements.",
109 "The type of the second-position elements.",
110 "The output type for first-position elements.",
111 "The output type for second-position elements.",
112 "The applicative context."
113 )]
114 #[document_parameters(
116 "The function for first-position element references.",
117 "The function for second-position element references.",
118 "The bitraversable structure to traverse by reference."
119 )]
120 #[document_returns("The transformed structure wrapped in the applicative context.")]
122 #[document_examples]
123 fn ref_bi_traverse<
138 'a,
139 FnBrand,
140 A: 'a + Clone,
141 B: 'a + Clone,
142 C: 'a + Clone,
143 D: 'a + Clone,
144 F: Applicative,
145 >(
146 f: impl Fn(&A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
147 g: impl Fn(&B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
148 p: &Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
149 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>)
150 where
151 FnBrand: LiftFn + 'a,
152 Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>): Clone,
153 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>): Clone,
154 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>): Clone;
155
156 #[document_signature]
161 #[document_type_parameters(
163 "The lifetime of the values.",
164 "The brand of the cloneable function wrapper.",
165 "The type of the first-position elements.",
166 "The type of the second-position elements.",
167 "The applicative context."
168 )]
169 #[document_parameters("The bitraversable structure containing applicative values.")]
171 #[document_returns("The applicative context wrapping the bitraversable structure.")]
173 #[document_examples]
174 fn ref_bi_sequence<'a, FnBrand, A: 'a + Clone, B: 'a + Clone, F: Applicative>(
186 ta: &Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>), Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>)>)
187 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>)>)
188 where
189 FnBrand: LiftFn + 'a,
190 Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>): Clone,
191 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
192 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
193 Self::ref_bi_traverse::<
194 FnBrand,
195 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>),
196 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>),
197 A,
198 B,
199 F,
200 >(Clone::clone, Clone::clone, ta)
201 }
202 }
203
204 #[document_signature]
208 #[document_type_parameters(
210 "The lifetime of the values.",
211 "The brand of the bitraversable structure.",
212 "The brand of the cloneable function wrapper.",
213 "The type of the first-position elements.",
214 "The type of the second-position elements.",
215 "The output type for first-position elements.",
216 "The output type for second-position elements.",
217 "The applicative context."
218 )]
219 #[document_parameters(
221 "The function for first-position element references.",
222 "The function for second-position element references.",
223 "The bitraversable structure to traverse by reference."
224 )]
225 #[document_returns("The transformed structure wrapped in the applicative context.")]
227 #[document_examples]
228 pub fn ref_bi_traverse<
243 'a,
244 Brand: RefBitraversable,
245 FnBrand,
246 A: 'a + Clone,
247 B: 'a + Clone,
248 C: 'a + Clone,
249 D: 'a + Clone,
250 F: Applicative,
251 >(
252 f: impl Fn(&A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
253 g: impl Fn(&B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
254 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
255 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>)
256 where
257 FnBrand: LiftFn + 'a,
258 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>): Clone,
259 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>): Clone,
260 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>): Clone, {
261 Brand::ref_bi_traverse::<FnBrand, A, B, C, D, F>(f, g, p)
262 }
263
264 #[document_signature]
268 #[document_type_parameters(
270 "The lifetime of the values.",
271 "The brand of the bitraversable structure.",
272 "The brand of the cloneable function wrapper.",
273 "The type of the first-position elements.",
274 "The type of the second-position elements.",
275 "The applicative context."
276 )]
277 #[document_parameters("The bitraversable structure containing applicative values.")]
279 #[document_returns("The applicative context wrapping the bitraversable structure.")]
281 #[document_examples]
282 pub fn ref_bi_sequence<
294 'a,
295 Brand: RefBitraversable,
296 FnBrand,
297 A: 'a + Clone,
298 B: 'a + Clone,
299 F: Applicative,
300 >(
301 ta: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>), Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>)>)
302 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>)>)
303 where
304 FnBrand: LiftFn + 'a,
305 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>): Clone,
306 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
307 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
308 Brand::ref_bi_sequence::<FnBrand, A, B, F>(ta)
309 }
310
311 #[document_signature]
315 #[document_type_parameters(
317 "The lifetime of the values.",
318 "The brand of the bitraversable structure.",
319 "The brand of the cloneable function wrapper.",
320 "The type of the first-position elements.",
321 "The type of the second-position elements (unchanged).",
322 "The output type for first-position elements.",
323 "The applicative context."
324 )]
325 #[document_parameters(
327 "The function for first-position element references.",
328 "The bitraversable structure to traverse by reference."
329 )]
330 #[document_returns("The transformed structure wrapped in the applicative context.")]
332 #[document_examples]
333 pub fn ref_bi_traverse_left<
348 'a,
349 Brand: RefBitraversable,
350 FnBrand,
351 A: 'a + Clone,
352 B: 'a + Clone,
353 C: 'a + Clone,
354 F: Applicative,
355 >(
356 f: impl Fn(&A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
357 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
358 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>)>)
359 where
360 FnBrand: LiftFn + 'a,
361 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>): Clone,
362 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>): Clone,
363 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
364 Brand::ref_bi_traverse::<FnBrand, A, B, C, B, F>(f, |b: &B| F::pure(b.clone()), p)
365 }
366
367 #[document_signature]
371 #[document_type_parameters(
373 "The lifetime of the values.",
374 "The brand of the bitraversable structure.",
375 "The brand of the cloneable function wrapper.",
376 "The type of the first-position elements (unchanged).",
377 "The type of the second-position elements.",
378 "The output type for second-position elements.",
379 "The applicative context."
380 )]
381 #[document_parameters(
383 "The function for second-position element references.",
384 "The bitraversable structure to traverse by reference."
385 )]
386 #[document_returns("The transformed structure wrapped in the applicative context.")]
388 #[document_examples]
389 pub fn ref_bi_traverse_right<
404 'a,
405 Brand: RefBitraversable,
406 FnBrand,
407 A: 'a + Clone,
408 B: 'a + Clone,
409 D: 'a + Clone,
410 F: Applicative,
411 >(
412 g: impl Fn(&B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
413 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
414 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>)>)
415 where
416 FnBrand: LiftFn + 'a,
417 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>): Clone,
418 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
419 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>): Clone, {
420 Brand::ref_bi_traverse::<FnBrand, A, B, A, D, F>(|a: &A| F::pure(a.clone()), g, p)
421 }
422
423 #[document_signature]
427 #[document_type_parameters(
429 "The lifetime of the values.",
430 "The brand of the bitraversable structure.",
431 "The brand of the cloneable function wrapper.",
432 "The type of the first-position elements.",
433 "The type of the second-position elements.",
434 "The output type for first-position elements.",
435 "The output type for second-position elements.",
436 "The applicative context."
437 )]
438 #[document_parameters(
440 "The bitraversable structure to traverse by reference.",
441 "The function for first-position element references.",
442 "The function for second-position element references."
443 )]
444 #[document_returns("The transformed structure wrapped in the applicative context.")]
446 #[document_examples]
447 pub fn ref_bi_for<
463 'a,
464 Brand: RefBitraversable,
465 FnBrand,
466 A: 'a + Clone,
467 B: 'a + Clone,
468 C: 'a + Clone,
469 D: 'a + Clone,
470 F: Applicative,
471 >(
472 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
473 f: impl Fn(&A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
474 g: impl Fn(&B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
475 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>)
476 where
477 FnBrand: LiftFn + 'a,
478 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>): Clone,
479 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>): Clone,
480 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>): Clone, {
481 Brand::ref_bi_traverse::<FnBrand, A, B, C, D, F>(f, g, p)
482 }
483
484 #[document_signature]
488 #[document_type_parameters(
490 "The lifetime of the values.",
491 "The brand of the bitraversable structure.",
492 "The brand of the cloneable function wrapper.",
493 "The type of the first-position elements.",
494 "The type of the second-position elements (unchanged).",
495 "The output type for first-position elements.",
496 "The applicative context."
497 )]
498 #[document_parameters(
500 "The bitraversable structure to traverse by reference.",
501 "The function for first-position element references."
502 )]
503 #[document_returns("The transformed structure wrapped in the applicative context.")]
505 #[document_examples]
506 pub fn ref_bi_for_left<
519 'a,
520 Brand: RefBitraversable,
521 FnBrand,
522 A: 'a + Clone,
523 B: 'a + Clone,
524 C: 'a + Clone,
525 F: Applicative,
526 >(
527 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
528 f: impl Fn(&A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
529 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>)>)
530 where
531 FnBrand: LiftFn + 'a,
532 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>): Clone,
533 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>): Clone,
534 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
535 Brand::ref_bi_traverse::<FnBrand, A, B, C, B, F>(f, |b: &B| F::pure(b.clone()), p)
536 }
537
538 #[document_signature]
542 #[document_type_parameters(
544 "The lifetime of the values.",
545 "The brand of the bitraversable structure.",
546 "The brand of the cloneable function wrapper.",
547 "The type of the first-position elements (unchanged).",
548 "The type of the second-position elements.",
549 "The output type for second-position elements.",
550 "The applicative context."
551 )]
552 #[document_parameters(
554 "The bitraversable structure to traverse by reference.",
555 "The function for second-position element references."
556 )]
557 #[document_returns("The transformed structure wrapped in the applicative context.")]
559 #[document_examples]
560 pub fn ref_bi_for_right<
573 'a,
574 Brand: RefBitraversable,
575 FnBrand,
576 A: 'a + Clone,
577 B: 'a + Clone,
578 D: 'a + Clone,
579 F: Applicative,
580 >(
581 p: &Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
582 g: impl Fn(&B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
583 ) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>)>)
584 where
585 FnBrand: LiftFn + 'a,
586 Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>): Clone,
587 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
588 Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>): Clone, {
589 Brand::ref_bi_traverse::<FnBrand, A, B, A, D, F>(|a: &A| F::pure(a.clone()), g, p)
590 }
591}
592
593pub use inner::*;