Closed morteako closed 4 months ago
If you want, add this to CHANGELOG.md under unreleased:
The rule now simplifies:
- `Array.length (Array.fromList list)` to `List.length list`
- `List.length (Array.toList array)` to `Array.length array` (same for `Array.toIndexedList`)
- `List.isEmpty (Array.toList array)` to `Array.isEmpty array` (same for `Array.toIndexedList`)
- `List.length (Set.toList set)` to `Set.size set`
- `List.isEmpty (Set.toList set)` to `Set.isEmpty set`
- `List.length (Dict.toList dict)` to `Dict.size dict` (same for `Dict.values` and `Dict.keys`)
- `List.isEmpty (Dict.toList dict)` to `ict.isEmpty dict` (same for `Dict.values` and `Dict.keys`)
Simplifies uneccessary convertions from a Collection into List before a List.length / List.size, when you could just do Collection.size or Collection.isEmpty
Mentioned before in comment here: https://github.com/jfmengels/elm-review-simplify/issues/290#issuecomment-1975196945
Also adds one simplification for
Array.length (Array.fromList list)
Simplifications:
Array
Set
Dict