Skip to main content

ReviewOptic

Trait ReviewOptic 

Source
pub trait ReviewOptic<'a, S: 'a, T: 'a, A: 'a, B: 'a> {
    // Required method
    fn evaluate(
        &self,
        pab: <TaggedBrand as Kind_266801a817966495>::Of<'a, A, B>,
    ) -> <TaggedBrand as Kind_266801a817966495>::Of<'a, S, T>;
}
Expand description

A review optic.

§Type Parameters

  • 'a: The lifetime of the values.
  • S: The source type of the structure.
  • T: The target type of the structure after an update.
  • A: The source type of the focus.
  • B: The target type of the focus after an update.

Required Methods§

Source

fn evaluate( &self, pab: <TaggedBrand as Kind_266801a817966495>::Of<'a, A, B>, ) -> <TaggedBrand as Kind_266801a817966495>::Of<'a, S, T>

Evaluate the optic with the tagged profunctor.

§Type Signature

(&self, Tagged A B) -> Tagged S T

§Parameters
  • &self: The optic instance.
  • pab: The profunctor value to transform.
§Returns

The transformed tagged profunctor value.

§Examples
use fp_library::{
	brands::{
		optics::*,
		*,
	},
	classes::optics::*,
	functions::*,
	types::optics::*,
};

let r: PrismPrime<RcBrand, Option<i32>, i32> = PrismPrime::from_option(|o| o, Some);
let f = Tagged::new(21);
let reviewed = <PrismPrime<RcBrand, Option<i32>, i32> as ReviewOptic<
	Option<i32>,
	Option<i32>,
	i32,
	i32,
>>::evaluate(&r, f);
assert_eq!(reviewed.0, Some(21));

Implementors§

Source§

impl<'a, PointerBrand, S, A> ReviewOptic<'a, S, S, A, A> for ReviewPrime<'a, PointerBrand, S, A>
where PointerBrand: ToDynCloneFn, S: 'a, A: 'a,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The type of the structure.
  • A: The type of the focus.
Source§

impl<'a, PointerBrand, S, T, A, B> ReviewOptic<'a, S, T, A, B> for Review<'a, PointerBrand, S, T, A, B>
where PointerBrand: ToDynCloneFn, S: 'a, T: 'a, A: 'a, B: 'a,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The source type of the structure.
  • T: The target type of the structure.
  • A: The source type of the focus.
  • B: The target type of the focus.
Source§

impl<'a, PointerBrand, S, T, A, B, O> ReviewOptic<'a, B, A, T, S> for ReversedOptic<'a, PointerBrand, S, T, A, B, O>
where PointerBrand: ToDynCloneFn + 'static, O: LensOptic<'a, S, T, A, B>, S: 'a + 'static, T: 'a + 'static, A: 'a + 'static, B: 'a + 'static,

ReviewOptic for ReversedOptic - reversing any optic >= Lens.

ReverseBrand<TaggedBrand> has Strong (from TaggedBrand: Costrong), satisfying the P: Strong bound required by LensOptic::evaluate.

This covers Iso and Lens, matching the PureScript semantics where Re Tagged has Strong (from Tagged: Costrong) but not Choice (since Tagged does not implement Cochoice).

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The cloneable function pointer brand.
  • S: The source type of the original optic.
  • T: The target type of the original optic.
  • A: The focus source type of the original optic.
  • B: The focus target type of the original optic.
  • O: The inner optic type.
Source§

impl<'a, PointerBrand, S: 'a, A: 'a> ReviewOptic<'a, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
where PointerBrand: ToDynCloneFn,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The type of the structure.
  • A: The type of the focus.
Source§

impl<'a, PointerBrand, S: 'a, A: 'a> ReviewOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>
where PointerBrand: ToDynCloneFn,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The type of the structure.
  • A: The type of the focus.
Source§

impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> ReviewOptic<'a, S, T, A, B> for Iso<'a, PointerBrand, S, T, A, B>
where PointerBrand: ToDynCloneFn,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The source type of the structure.
  • T: The target type of the structure after an update.
  • A: The source type of the focus.
  • B: The target type of the focus after an update.
Source§

impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> ReviewOptic<'a, S, T, A, B> for Prism<'a, PointerBrand, S, T, A, B>
where PointerBrand: ToDynCloneFn,

§Type Parameters
  • 'a: The lifetime of the values.
  • PointerBrand: The reference-counted pointer type.
  • S: The source type of the structure.
  • T: The target type of the structure after an update.
  • A: The source type of the focus.
  • B: The target type of the focus after an update.
Source§

impl<'a, S, T, M, N, A, B, O1, O2> ReviewOptic<'a, S, T, A, B> for Composed<'a, S, T, M, N, A, B, O1, O2>
where O1: ReviewOptic<'a, S, T, M, N>, O2: ReviewOptic<'a, M, N, A, B>, M: 'a, N: 'a,

§Type Parameters
  • 'a: The lifetime of the values.
  • S: The source type of the outer structure.
  • T: The target type of the outer structure.
  • M: The source type of the intermediate structure.
  • N: The target type of the intermediate structure.
  • A: The source type of the focus.
  • B: The target type of the focus.
  • O1: The first optic.
  • O2: The second optic.