optics-core-0.1

Safe HaskellNone
LanguageHaskell2010

Optics.Arrow

Synopsis

Documentation

class Arrow arr => ArrowOptic k arr where #

Minimal complete definition

overA

Methods

overA :: Optic k '[] s t a b -> arr a b -> arr s t #

Turn an optic into an arrow transformer.

Instances
ArrowChoice arr => ArrowOptic An_AffineTraversal arr # 
Instance details

Defined in Optics.Arrow

Methods

overA :: Optic An_AffineTraversal [] s t a b -> arr a b -> arr s t #

ArrowChoice arr => ArrowOptic A_Prism arr # 
Instance details

Defined in Optics.Arrow

Methods

overA :: Optic A_Prism [] s t a b -> arr a b -> arr s t #

Arrow arr => ArrowOptic A_Lens arr # 
Instance details

Defined in Optics.Arrow

Methods

overA :: Optic A_Lens [] s t a b -> arr a b -> arr s t #

Arrow arr => ArrowOptic An_Iso arr # 
Instance details

Defined in Optics.Arrow

Methods

overA :: Optic An_Iso [] s t a b -> arr a b -> arr s t #

assignA :: (Is k A_Setter, Arrow arr) => Optic k '[] s t a b -> arr s b -> 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)