optics-core-0.4.1: Optics as an abstract interface: core definitions
Safe HaskellNone
LanguageHaskell2010

Optics.Arrow

Description

 
Synopsis

Documentation

class Arrow arr => ArrowOptic k arr where Source #

Methods

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

Turn an optic into an arrow transformer.

Instances

Instances details
ArrowChoice arr => ArrowOptic An_AffineTraversal arr Source # 
Instance details

Defined in Optics.Arrow

Methods

overA :: forall (is :: IxList) s t a b. Optic An_AffineTraversal is s t a b -> arr a b -> arr s t Source #

ArrowChoice arr => ArrowOptic A_Prism arr Source # 
Instance details

Defined in Optics.Arrow

Methods

overA :: forall (is :: IxList) s t a b. Optic A_Prism is s t a b -> arr a b -> arr s t Source #

Arrow arr => ArrowOptic A_Lens arr Source # 
Instance details

Defined in Optics.Arrow

Methods

overA :: forall (is :: IxList) s t a b. Optic A_Lens is s t a b -> arr a b -> arr s t Source #

Arrow arr => ArrowOptic An_Iso arr Source # 
Instance details

Defined in Optics.Arrow

Methods

overA :: forall (is :: IxList) s t a b. Optic An_Iso is s t a b -> arr a b -> arr s t Source #

assignA :: (Is k A_Setter, Arrow arr) => Optic k is s t a b -> arr s b -> arr s t Source #

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)