Skip to content

Commit

Permalink
optics: clarify first traversal exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
GoNZooo committed Aug 21, 2022
1 parent ba8d92d commit f8d1b00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions basics/extras/optics.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,9 @@ Q> "{\"a\": 4, \"b\": [{\"v\": 5}, {\"v\": 42}]}" & key "b" . values . key "v" .

### Exercises (Traversals and Folds)

1. Use a traversal to create a function that will traverse the values of a map and uppercase all the
keys.
1. Create a function `uppercaseKeys :: Map Text a -> Map Text a` that uppercases all the keys. You
can turn the map into a `[(Text, a)]` with `Map.toList` and back into a `Map Text a` with
`Map.fromList`. Use a traversal and lenses to modify the keys.

2. Use a combination of traversals and the prism you defined for strings parsable as numbers to
create a function that will traverse over a `Value`[0] and if it's an object, will modify any
Expand Down

0 comments on commit f8d1b00

Please sign in to comment.