Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Lens.Micro.FieldN
Documentation
class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Methods
Gives access to the 1st field of a tuple (up to 5-tuples).
Getting the 1st component:
>>>
(1,2,3,4,5) ^. _1
1
Setting the 1st component:
>>>
(1,2,3) & _1 .~ 10
(10,2,3)
Note that this lens is lazy, and can set fields even of undefined
:
>>>
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:
>>>
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).
Instances
Field1 (a, b) (a', b) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c) (a', b, c) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d) (a', b, c, d) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d, e) (a', b, c, d, e) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d, e, f) (a', b, c, d, e, f) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d, e, f, g) (a', b, c, d, e, f, g) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d, e, f, g, h) (a', b, c, d, e, f, g, h) a a' Source # | |
Defined in Lens.Micro.FieldN | |
Field1 (a, b, c, d, e, f, g, h, i) (a', b, c, d, e, f, g, h, i) a a' Source # | |
Defined in Lens.Micro.FieldN |
class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field2 (a, b) (a, b') b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c) (a, b', c) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d) (a, b', c, d) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d, e) (a, b', c, d, e) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d, e, f) (a, b', c, d, e, f) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d, e, f, g) (a, b', c, d, e, f, g) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d, e, f, g, h) (a, b', c, d, e, f, g, h) b b' Source # | |
Defined in Lens.Micro.FieldN | |
Field2 (a, b, c, d, e, f, g, h, i) (a, b', c, d, e, f, g, h, i) b b' Source # | |
Defined in Lens.Micro.FieldN |
class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field3 (a, b, c) (a, b, c') c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d) (a, b, c', d) c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d, e) (a, b, c', d, e) c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d, e, f) (a, b, c', d, e, f) c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d, e, f, g) (a, b, c', d, e, f, g) c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d, e, f, g, h) (a, b, c', d, e, f, g, h) c c' Source # | |
Defined in Lens.Micro.FieldN | |
Field3 (a, b, c, d, e, f, g, h, i) (a, b, c', d, e, f, g, h, i) c c' Source # | |
Defined in Lens.Micro.FieldN |
class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field4 (a, b, c, d) (a, b, c, d') d d' Source # | |
Defined in Lens.Micro.FieldN | |
Field4 (a, b, c, d, e) (a, b, c, d', e) d d' Source # | |
Defined in Lens.Micro.FieldN | |
Field4 (a, b, c, d, e, f) (a, b, c, d', e, f) d d' Source # | |
Defined in Lens.Micro.FieldN | |
Field4 (a, b, c, d, e, f, g) (a, b, c, d', e, f, g) d d' Source # | |
Defined in Lens.Micro.FieldN | |
Field4 (a, b, c, d, e, f, g, h) (a, b, c, d', e, f, g, h) d d' Source # | |
Defined in Lens.Micro.FieldN | |
Field4 (a, b, c, d, e, f, g, h, i) (a, b, c, d', e, f, g, h, i) d d' Source # | |
Defined in Lens.Micro.FieldN |
class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field5 (a, b, c, d, e) (a, b, c, d, e') e e' Source # | |
Defined in Lens.Micro.FieldN | |
Field5 (a, b, c, d, e, f) (a, b, c, d, e', f) e e' Source # | |
Defined in Lens.Micro.FieldN | |
Field5 (a, b, c, d, e, f, g) (a, b, c, d, e', f, g) e e' Source # | |
Defined in Lens.Micro.FieldN | |
Field5 (a, b, c, d, e, f, g, h) (a, b, c, d, e', f, g, h) e e' Source # | |
Defined in Lens.Micro.FieldN | |
Field5 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e', f, g, h, i) e e' Source # | |
Defined in Lens.Micro.FieldN |
class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field6 (a, b, c, d, e, f) (a, b, c, d, e, f') f f' Source # | |
Defined in Lens.Micro.FieldN | |
Field6 (a, b, c, d, e, f, g) (a, b, c, d, e, f', g) f f' Source # | |
Defined in Lens.Micro.FieldN | |
Field6 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f', g, h) f f' Source # | |
Defined in Lens.Micro.FieldN | |
Field6 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f', g, h, i) f f' Source # | |
Defined in Lens.Micro.FieldN |
class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field7 (a, b, c, d, e, f, g) (a, b, c, d, e, f, g') g g' Source # | |
Defined in Lens.Micro.FieldN | |
Field7 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g', h) g g' Source # | |
Defined in Lens.Micro.FieldN | |
Field7 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g', h, i) g g' Source # | |
Defined in Lens.Micro.FieldN |
class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Instances
Field8 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h') h h' Source # | |
Defined in Lens.Micro.FieldN | |
Field8 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h', i) h h' Source # | |
Defined in Lens.Micro.FieldN |