Chris Penner 的这篇文章谈到了“Witherable Optics”;可用于从结构中过滤项目的光学元件。
本文对这些光学器件使用以下“Van Laarhoven”表示:
type Wither s t a b = forall f. Alternative f => (a -> f b) -> s -> f t
大多数(如果不是全部)Van Laarhoven 光学具有等效的 profunctor 表示。例如镜头:
type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
相当于:
type Lens s t a b = forall p. Strong p => p a b -> p s t
是否Wither
也有生产者代表?如果是这样,那是什么?