# Hoogle Search

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

1. lens Control.Lens.At

NB: Setting the value of this Traversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
```
```>>> Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
```
```>>> Seq.fromList [a,b,c,d] ^? ix 2
Just c
```
```>>> Seq.fromList [] ^? ix 2
Nothing
```

2. lens Control.Lens.At

NB: Setting the value of this Traversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
```
```>>> Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
```
```>>> Seq.fromList [a,b,c,d] ^? ix 2
Just c
```
```>>> Seq.fromList [] ^? ix 2
Nothing
```

3. lens Control.Lens.Combinators

NB: Setting the value of this Traversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
```
```>>> Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
```
```>>> Seq.fromList [a,b,c,d] ^? ix 2
Just c
```
```>>> Seq.fromList [] ^? ix 2
Nothing
```

4. lens Control.Lens.Combinators

NB: Setting the value of this Traversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
```
```>>> Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
```
```>>> Seq.fromList [a,b,c,d] ^? ix 2
Just c
```
```>>> Seq.fromList [] ^? ix 2
Nothing
```

5. microlens Lens.Micro

This traversal lets you access (and update) an arbitrary element in a list, array, Map, etc. (If you want to insert or delete elements as well, look at at.) An example for lists:

```>>> [0..5] & ix 3 .~ 10
[0,1,2,10,4,5]
```
You can use it for getting, too:
```>>> [0..5] ^? ix 3
Just 3
```
Of course, the element may not be present (which means that you can use ix as a safe variant of (!!)):
```>>> [0..5] ^? ix 10
Nothing
```
Another useful instance is the one for functions – it lets you modify their outputs for specific inputs. For instance, here's maximum that returns 0 when the list is empty (instead of throwing an exception):
```maximum0 = maximum & ix [] .~ 0
```
The following instances are provided in this package:
```ix :: Int -> Traversal' [a] a

ix :: Int -> Traversal' (NonEmpty a) a

ix :: (Eq e) => e -> Traversal' (e -> a) a
```
You can also use ix with types from array, bytestring, and containers by using microlens-ghc, or additionally with types from vector, text, and unordered-containers by using microlens-platform.

6. microlens Lens.Micro.Internal

This traversal lets you access (and update) an arbitrary element in a list, array, Map, etc. (If you want to insert or delete elements as well, look at at.) An example for lists:

```>>> [0..5] & ix 3 .~ 10
[0,1,2,10,4,5]
```
You can use it for getting, too:
```>>> [0..5] ^? ix 3
Just 3
```
Of course, the element may not be present (which means that you can use ix as a safe variant of (!!)):
```>>> [0..5] ^? ix 10
Nothing
```
Another useful instance is the one for functions – it lets you modify their outputs for specific inputs. For instance, here's maximum that returns 0 when the list is empty (instead of throwing an exception):
```maximum0 = maximum & ix [] .~ 0
```
The following instances are provided in this package:
```ix :: Int -> Traversal' [a] a

ix :: Int -> Traversal' (NonEmpty a) a

ix :: (Eq e) => e -> Traversal' (e -> a) a
```
You can also use ix with types from array, bytestring, and containers by using microlens-ghc, or additionally with types from vector, text, and unordered-containers by using microlens-platform.

7. rio RIO.Lens

This traversal lets you access (and update) an arbitrary element in a list, array, Map, etc. (If you want to insert or delete elements as well, look at at.) An example for lists:

```>>> [0..5] & ix 3 .~ 10
[0,1,2,10,4,5]
```
You can use it for getting, too:
```>>> [0..5] ^? ix 3
Just 3
```
Of course, the element may not be present (which means that you can use ix as a safe variant of (!!)):
```>>> [0..5] ^? ix 10
Nothing
```
Another useful instance is the one for functions – it lets you modify their outputs for specific inputs. For instance, here's maximum that returns 0 when the list is empty (instead of throwing an exception):
```maximum0 = maximum & ix [] .~ 0
```
The following instances are provided in this package:
```ix :: Int -> Traversal' [a] a

ix :: Int -> Traversal' (NonEmpty a) a

ix :: (Eq e) => e -> Traversal' (e -> a) a
```
You can also use ix with types from array, bytestring, and containers by using microlens-ghc, or additionally with types from vector, text, and unordered-containers by using microlens-platform.

8. optics-core Optics.At.Core

NB: Setting the value of this AffineTraversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> [1,2,3,4] & ix 2 %~ (*10)
[1,2,30,4]
```
```>>> "abcd" & ix 2 .~ 'e'
"abed"
```
```>>> "abcd" ^? ix 2
Just 'c'
```
```>>> [] ^? ix 2
Nothing
```

9. optics-core Optics.At.Core

NB: Setting the value of this AffineTraversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> [1,2,3,4] & ix 2 %~ (*10)
[1,2,30,4]
```
```>>> "abcd" & ix 2 .~ 'e'
"abed"
```
```>>> "abcd" ^? ix 2
Just 'c'
```
```>>> [] ^? ix 2
Nothing
```

10. diagrams-lib Diagrams.Prelude

NB: Setting the value of this Traversal will only set the value in at if it is already present. If you want to be able to insert missing values, you want at.

```>>> Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
```
```>>> Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
```
```>>> Seq.fromList [a,b,c,d] ^? ix 2
Just c
```
```>>> Seq.fromList [] ^? ix 2
Nothing
```

Page 1 of many | Next