@@ -797,6 +797,50 @@ Non-backwards compatible changes
797
797
IO.Instances
798
798
```
799
799
800
+ ### Standardisation of ` insertAt ` /` updateAt ` /` removeAt `
801
+
802
+ * Previously, the names and argument order of index-based insertion, update and removal functions for
803
+ various types of lists and vectors were inconsistent.
804
+
805
+ * To fix this the names have all been standardised to ` insertAt ` /` updateAt ` /` removeAt ` .
806
+
807
+ * Correspondingly the following changes have occurred:
808
+
809
+ * In ` Data.List.Base ` the following have been added:
810
+ ``` agda
811
+ insertAt : (xs : List A) → Fin (suc (length xs)) → A → List A
812
+ updateAt : (xs : List A) → Fin (length xs) → (A → A) → List A
813
+ removeAt : (xs : List A) → Fin (length xs) → List A
814
+ ```
815
+ and the following has been deprecated
816
+ ```
817
+ _─_ ↦ removeAt
818
+ ```
819
+
820
+ * In ` Data.Vec.Base ` :
821
+ ``` agda
822
+ insert ↦ insertAt
823
+ remove ↦ removeAt
824
+
825
+ updateAt : Fin n → (A → A) → Vec A n → Vec A n
826
+ ↦
827
+ updateAt : Vec A n → Fin n → (A → A) → Vec A n
828
+ ```
829
+
830
+ * In ` Data.Vec.Functional ` :
831
+ ``` agda
832
+ remove : Fin (suc n) → Vector A (suc n) → Vector A n
833
+ ↦
834
+ removeAt : Vector A (suc n) → Fin (suc n) → Vector A n
835
+
836
+ updateAt : Fin n → (A → A) → Vector A n → Vector A n
837
+ ↦
838
+ updateAt : Vector A n → Fin n → (A → A) → Vector A n
839
+ ```
840
+
841
+ * The old names (and the names of all proofs about these functions) have been deprecated appropriately.
842
+
843
+
800
844
### Changes to triple reasoning interface
801
845
802
846
* The module ` Relation.Binary.Reasoning.Base.Triple ` now takes an extra proof that the strict
@@ -1321,6 +1365,11 @@ Deprecated names
1321
1365
+-isAbelianGroup ↦ +-0-isAbelianGroup
1322
1366
```
1323
1367
1368
+ * In ` Data.List.Base ` :
1369
+ ```
1370
+ _─_ ↦ removeAt
1371
+ ```
1372
+
1324
1373
* In ` Data.List.Properties ` :
1325
1374
``` agda
1326
1375
map-id₂ ↦ map-id-local
@@ -1337,7 +1386,10 @@ Deprecated names
1337
1386
1338
1387
ʳ++-++ ↦ ++-ʳ++
1339
1388
1340
- take++drop ↦ take++drop≡id
1389
+ take++drop ↦ take++drop≡id
1390
+
1391
+ length-─ ↦ length-removeAt
1392
+ map-─ ↦ map-removeAt
1341
1393
```
1342
1394
1343
1395
* In ` Data.List.NonEmpty.Properties ` :
@@ -1350,8 +1402,8 @@ Deprecated names
1350
1402
* In ` Data.List.Relation.Unary.All.Properties ` :
1351
1403
``` agda
1352
1404
updateAt-id-relative ↦ updateAt-id-local
1353
- updateAt-compose-relative ↦ updateAt-∘ -local
1354
- updateAt-compose ↦ updateAt-∘
1405
+ updateAt-compose-relative ↦ updateAt-updateAt -local
1406
+ updateAt-compose ↦ updateAt-updateAt
1355
1407
updateAt-cong-relative ↦ updateAt-cong-local
1356
1408
```
1357
1409
@@ -1497,6 +1549,12 @@ Deprecated names
1497
1549
map-compose ↦ map-∘
1498
1550
```
1499
1551
1552
+ * In ` Data.Vec.Base ` :
1553
+ ```
1554
+ remove ↦ removeAt
1555
+ insert ↦ insertAt
1556
+ ```
1557
+
1500
1558
* In ` Data.Vec.Properties ` :
1501
1559
```
1502
1560
take-distr-zipWith ↦ take-zipWith
@@ -1505,8 +1563,8 @@ Deprecated names
1505
1563
drop-distr-map ↦ drop-map
1506
1564
1507
1565
updateAt-id-relative ↦ updateAt-id-local
1508
- updateAt-compose-relative ↦ updateAt-∘ -local
1509
- updateAt-compose ↦ updateAt-∘
1566
+ updateAt-compose-relative ↦ updateAt-updateAt -local
1567
+ updateAt-compose ↦ updateAt-updateAt
1510
1568
updateAt-cong-relative ↦ updateAt-cong-local
1511
1569
1512
1570
[]%=-compose ↦ []%=-∘
@@ -1516,7 +1574,15 @@ Deprecated names
1516
1574
idIsFold ↦ id-is-foldr
1517
1575
sum-++-commute ↦ sum-++
1518
1576
1519
- take-drop-id ↦ take++drop≡id
1577
+ take-drop-id ↦ take++drop≡id
1578
+
1579
+ map-insert ↦ map-insertAt
1580
+
1581
+ insert-lookup ↦ insertAt-lookup
1582
+ insert-punchIn ↦ insertAt-punchIn
1583
+ remove-PunchOut ↦ removeAt-punchOut
1584
+ remove-insert ↦ removeAt-insertAt
1585
+ insert-remove ↦ insertAt-removeAt
1520
1586
1521
1587
lookup-inject≤-take ↦ lookup-take-inject≤
1522
1588
```
@@ -1532,11 +1598,17 @@ Deprecated names
1532
1598
* In ` Data.Vec.Functional.Properties ` :
1533
1599
```
1534
1600
updateAt-id-relative ↦ updateAt-id-local
1535
- updateAt-compose-relative ↦ updateAt-∘ -local
1536
- updateAt-compose ↦ updateAt-∘
1601
+ updateAt-compose-relative ↦ updateAt-updateAt -local
1602
+ updateAt-compose ↦ updateAt-updateAt
1537
1603
updateAt-cong-relative ↦ updateAt-cong-local
1538
1604
1539
1605
map-updateAt ↦ map-updateAt-local
1606
+
1607
+ insert-lookup ↦ insertAt-lookup
1608
+ insert-punchIn ↦ insertAt-punchIn
1609
+ remove-punchOut ↦ removeAt-punchOut
1610
+ remove-insert ↦ removeAt-insertAt
1611
+ insert-remove ↦ insertAt-removeAt
1540
1612
```
1541
1613
NB. This last one is complicated by the * addition* of a 'global' property ` map-updateAt `
1542
1614
@@ -2312,7 +2384,7 @@ Additions to existing modules
2312
2384
gcd-zero : Zero 1ℤ gcd
2313
2385
```
2314
2386
2315
- * Added new functions in ` Data.List ` :
2387
+ * Added new functions in ` Data.List.Base ` :
2316
2388
``` agda
2317
2389
takeWhileᵇ : (A → Bool) → List A → List A
2318
2390
dropWhileᵇ : (A → Bool) → List A → List A
@@ -2331,14 +2403,14 @@ Additions to existing modules
2331
2403
find : Decidable P → List A → Maybe A
2332
2404
findIndex : Decidable P → (xs : List A) → Maybe $ Fin (length xs)
2333
2405
findIndices : Decidable P → (xs : List A) → List $ Fin (length xs)
2334
- ```
2335
2406
2336
- * Added new functions and definitions to ` Data.List.Base ` :
2337
- ``` agda
2338
- catMaybes : List (Maybe A) → List A
2339
- ap : List (A → B) → List A → List B
2340
- ++-rawMagma : Set a → RawMagma a _
2407
+ catMaybes : List (Maybe A) → List A
2408
+ ap : List (A → B) → List A → List B
2409
+ ++-rawMagma : Set a → RawMagma a _
2341
2410
++-[]-rawMonoid : Set a → RawMonoid a _
2411
+
2412
+ insertAt : (xs : List A) → Fin (suc (length xs)) → A → List A
2413
+ updateAt : (xs : List A) → Fin (length xs) → (A → A) → List A
2342
2414
```
2343
2415
2344
2416
* Added new proofs in ` Data.List.Relation.Binary.Lex.Strict ` :
@@ -2405,6 +2477,11 @@ Additions to existing modules
2405
2477
map-replicate : map f (replicate n x) ≡ replicate n (f x)
2406
2478
2407
2479
drop-drop : drop n (drop m xs) ≡ drop (m + n) xs
2480
+
2481
+ length-insertAt : length (insertAt xs i v) ≡ suc (length xs)
2482
+ length-removeAt′ : length xs ≡ suc (length (removeAt xs k))
2483
+ removeAt-insertAt : removeAt (insertAt xs i v) ((cast (sym (length-insertAt xs i v)) i)) ≡ xs
2484
+ insertAt-removeAt : insertAt (removeAt xs i) (cast (sym (lengthAt-removeAt xs i)) i) (lookup xs i) ≡ xs
2408
2485
```
2409
2486
2410
2487
* Added new patterns and definitions to ` Data.Nat.Base ` :
@@ -2841,6 +2918,9 @@ Additions to existing modules
2841
2918
fromList-map : cast _ (fromList (List.map f xs)) ≡ map f (fromList xs)
2842
2919
fromList-++ : cast _ (fromList (xs List.++ ys)) ≡ fromList xs ++ fromList ys
2843
2920
2921
+ length-toList : List.length (toList xs) ≡ length xs
2922
+ toList-insertAt : toList (insertAt xs i v) ≡ List.insertAt (toList xs) (Fin.cast (cong suc (sym (length-toList xs))) i) v
2923
+
2844
2924
truncate≡take : .(eq : n ≡ m + o) → truncate m≤n xs ≡ take m (cast eq xs)
2845
2925
take≡truncate : take m xs ≡ truncate (m≤m+n m n) xs
2846
2926
lookup-truncate : lookup (truncate m≤n xs) i ≡ lookup xs (Fin.inject≤ i m≤n)
0 commit comments