Heimdell / elm-optics / Optics.Basic

Some optics for basic types.

Maybe

just_ : Optics.Core.Prism pr (Maybe a) (Maybe b) a b

Match (go into) Just constructor.

nothing_ : Optics.Core.SimplePrism pr (Maybe a) ()

Match Nothing constructor.

Either

right_ : Optics.Core.Prism pr (Either c a) (Either c b) a b

Match Right constructor.

left_ : Optics.Core.Prism pr (Either a c) (Either b c) a b

Match Left constructor.

Filter

only : (a -> Basics.Bool) -> Optics.Core.SimpleTraversal a a

Pluggable filter.

Prevents reading and update for all parts that do to satisfy the predicate.

List

each : Optics.Core.Traversal (List a) (List b) a b

List fold/traversal.

nth : Basics.Int -> Optics.Core.SimpleTraversal (List a) a

Nth element of the list.

drop : Basics.Int -> Optics.Core.SimpleTraversal (List a) (List a)

Everything except first n elements of the list.

take : Basics.Int -> Optics.Core.SimpleTraversal (List a) (List a)

First n elements of the list.

The implementation will traverse n elements twice, because I was lazy and didn't write List.splitAt manually.

And there is no standard one.

cons : Optics.Core.Prism pr (List a) (List b) ( a, List a ) ( b, List b )

Match head/tail of a non-empty list.

nil : Optics.Core.Prism pr (List a) (List a) () ()

Match end of a non-empty list.

head : Optics.Core.SimpleTraversal (List a) a

List head.

tail : Optics.Core.SimpleTraversal (List a) (List a)

List tail.

Array

every : Optics.Core.Traversal (Array a) (Array b) a b

Array fold/traversal.

ith : Basics.Int -> Optics.Core.SimpleTraversal (Array a) a

Nth element of the array.

Tuple

first : Optics.Core.Lens n ( a, c ) ( b, c ) a b

First tuple element.

second : Optics.Core.Lens n ( c, a ) ( c, b ) a b

Second tuple element.

Dict

atKey : comparable_k -> Optics.Core.SimpleTraversal (Dict comparable_k v) v

Access to the dict element at given key.

assocs : Optics.Core.Iso pr ls (Dict comparable_k v) (Dict comparable_l w) (List ( comparable_k, v )) (List ( comparable_l, w ))

Dict <-> List.

dictValues : Optics.Core.Traversal (Dict comparable_k v) (Dict comparable_k w) v w

Traversal over values in the dictionary.