9 | ||| A Setter allows us to update zero or more values in a
10 | ||| larger data type.
11 | |||
12 | ||| Possible examples include updating single record fields, mapping
13 | ||| a function over the values in a `List` (or any other `Functor`),
14 | ||| or converting the characters in a string.
15 | |||
16 | ||| A Setter is parameterized over four parameters, because in general
17 | ||| we could not only update a value but also its type with an updating
18 | ||| function. Consider Setter `io`, where `s` corresponds to `IO a` and
19 | ||| `t` corresponds to `IO b`. Accordingly, if we have a function from
20 | ||| `a` to `b`, we can convert an `IO a` to an `IO b`.
26 | ||| Convenience alias for monomorphic setters, which do not allow
27 | ||| us to change the value and source types.
32 | --------------------------------------------------------------------------------
33 | -- Interface
34 | --------------------------------------------------------------------------------
36 | ||| Interface for converting other optics to setters. With the exception
37 | ||| of Fold and Getter, all optics in this library have an implementation
38 | ||| of `ToSetter`.
46 | --------------------------------------------------------------------------------
47 | -- Utilities
48 | --------------------------------------------------------------------------------
50 | ||| Use a Setter to update the data stored in a source value.
55 | ||| Use a Setter to set the data stored in a source value.
60 | ||| Sequential composition of setters.
65 | --------------------------------------------------------------------------------
66 | -- Predefined Setters
67 | --------------------------------------------------------------------------------
69 | ||| Every `Functor` gives rise to a polymorphic Setter via `map`.
74 | ||| Every contravariant functor gives rise to a polymorphic Setter via
75 | ||| `contramap`.
80 | --------------------------------------------------------------------------------
81 | -- State
82 | --------------------------------------------------------------------------------
84 | ||| Modify the current state with a setter
89 | ||| Modify the current state with a setter