Composition operators for collection fields.
- class Indexable a i where
- (#!) :: (Field a, Indexable (Dst a) i) => a -> i -> Src a :-> Maybe (Element (Dst a))
- (#!!) :: (Field a, Indexable (Dst a) i) => a -> i -> Src a :-> Element (Dst a)
Class of collection types that can be indexed into.
TODO: This should probably be a single-parameter type class with two associated types instead.
Compose a field with an
r .# coll #! idx
idx was not found from the collection, and
Just v if
v was found.
r .# coll #! idx =: Just v
sets the value at
idx in the collection to be
v. If the value
wasn't in the collection, it's inserted. The exact semantics of
insertion depend on the actual collection in question.
r .# coll #! idx =: Nothing
removes the value at
idx from the collection, if possible.