Source code on Github{-# OPTIONS --safe #-}
open import Prelude.Init; open SetAsType
open import Prelude.Functor
module Prelude.Lenses.VanLaarhoven where
record Functor′ (F : Type → Type) : Type₁ where
field fmap′ : ∀ {A B : Type} → (A → B) → (F A → F B)
_⟨$⟩_ = fmap′
open Functor′ ⦃...⦄ public
Const : Type → (Type → Type)
Const A _ = A
Id : Type → Type
Id = id
private variable A B I O : Type
instance
Functor′-Id : Functor′ Id
Functor′-Id .fmap′ = id
Functor′-Const : Functor′ (Const A)
Functor′-Const .fmap′ = const id
Lens : Type → Type → Type₁
Lens I O = ∀ F → ⦃ Functor′ F ⦄ → (I → F I) → (O → F O)
over : Lens I O → (I → I) → (O → O)
over l f o = l Id f o