HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulemicrolens-0.5.0.0Haskell2010

Lens.Micro.FieldN

  • 9 classes
classclass Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

  • _1 :: Lens s t a b

    Gives access to the 1st field of a tuple (up to 5-tuples).

    Getting the 1st component:

    Example1 expression
    (1,2,3,4,5) ^. _11

    Setting the 1st component:

    Example1 expression
    (1,2,3) & _1 .~ 10(10,2,3)

    Note that this lens is lazy, and can set fields even of undefined:

    Example1 expression
    set _1 10 undefined :: (Int, Int)(10,*** Exception: Prelude.undefined

    This is done to avoid violating a lens law stating that you can get back what you put:

    Example1 expression
    view _1 . set _1 10 $ (undefined :: (Int, Int))10

    The implementation (for 2-tuples) is:

    _1 f t = (,) <$> f    (fst t)
                 <*> pure (snd t)
    

    or, alternatively,

    _1 f ~(a,b) = (\a' -> (a',b)) <$> f a
    

    (where ~ means a lazy pattern).

    _2, _3, _4, and _5 are also available (see below).

Instances8Field1, …
  • Field1 (a, b) (a', b) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c) (a', b, c) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d) (a', b, c, d) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d, e) (a', b, c, d, e) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d, e, f) (a', b, c, d, e, f) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d, e, f, g) (a', b, c, d, e, f, g) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d, e, f, g, h) (a', b, c, d, e, f, g, h) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field1 (a, b, c, d, e, f, g, h, i) (a', b, c, d, e, f, g, h, i) a a'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances8Field2, …
  • Field2 (a, b) (a, b') b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c) (a, b', c) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d) (a, b', c, d) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d, e) (a, b', c, d, e) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d, e, f) (a, b', c, d, e, f) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d, e, f, g) (a, b', c, d, e, f, g) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d, e, f, g, h) (a, b', c, d, e, f, g, h) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field2 (a, b, c, d, e, f, g, h, i) (a, b', c, d, e, f, g, h, i) b b'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances7Field3, …
  • Field3 (a, b, c) (a, b, c') c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d) (a, b, c', d) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d, e) (a, b, c', d, e) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d, e, f) (a, b, c', d, e, f) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d, e, f, g) (a, b, c', d, e, f, g) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d, e, f, g, h) (a, b, c', d, e, f, g, h) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field3 (a, b, c, d, e, f, g, h, i) (a, b, c', d, e, f, g, h, i) c c'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances6Field4
  • Field4 (a, b, c, d) (a, b, c, d') d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field4 (a, b, c, d, e) (a, b, c, d', e) d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field4 (a, b, c, d, e, f) (a, b, c, d', e, f) d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field4 (a, b, c, d, e, f, g) (a, b, c, d', e, f, g) d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field4 (a, b, c, d, e, f, g, h) (a, b, c, d', e, f, g, h) d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field4 (a, b, c, d, e, f, g, h, i) (a, b, c, d', e, f, g, h, i) d d'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances5Field5
  • Field5 (a, b, c, d, e) (a, b, c, d, e') e e'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field5 (a, b, c, d, e, f) (a, b, c, d, e', f) e e'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field5 (a, b, c, d, e, f, g) (a, b, c, d, e', f, g) e e'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field5 (a, b, c, d, e, f, g, h) (a, b, c, d, e', f, g, h) e e'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field5 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e', f, g, h, i) e e'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances4Field6
  • Field6 (a, b, c, d, e, f) (a, b, c, d, e, f') f f'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field6 (a, b, c, d, e, f, g) (a, b, c, d, e, f', g) f f'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field6 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f', g, h) f f'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field6 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f', g, h, i) f f'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances3Field7
  • Field7 (a, b, c, d, e, f, g) (a, b, c, d, e, f, g') g g'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field7 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g', h) g g'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field7 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g', h, i) g g'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances2Field8
  • Field8 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h') h h'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
  • Field8 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h', i) h h'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN
classclass Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Methods

Instances1Field9
  • Field9 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h, i') i i'Defined in microlens-0.5.0.0 · Lens.Micro.FieldN