HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleoptics-core-0.4.1.1Haskell2010

Optics.Arrow

  • 1 class
  • 1 value
classclass Arrow arr => ArrowOptic (k :: OpticKind) (arr :: Type -> Type -> Type) where
#

Methods

  • overA :: Optic k is s t a b -> arr a b -> arr s t

    Turn an optic into an arrow transformer.

Instances4ArrowOptic
valueassignA
  1. :: (Is k A_Setter, Arrow arr)
  2. => Optic k is s t a b
  3. -> arr s b
  4. -> arr s t
#

Run an arrow command and use the output to set all the targets of an optic to the result.

runKleisli action ((), (), ()) where
  action =      assignA _1 (Kleisli (const getVal1))
           >>> assignA _2 (Kleisli (const getVal2))
           >>> assignA _3 (Kleisli (const getVal3))
  getVal1 :: Either String Int
  getVal1 = ...
  getVal2 :: Either String Bool
  getVal2 = ...
  getVal3 :: Either String Char
  getVal3 = ...

has the type Either String (Int, Bool, Char)