Skip to content

Commit 02ad1f4

Browse files
authored
Rename all and any to all? and any? for consistency (#1260)
1 parent 5e7249c commit 02ad1f4

File tree

11 files changed

+50
-21
lines changed

11 files changed

+50
-21
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ Deprecated names
9090
*-+-isSemiringWithoutAnnihilatingZero ↦ +-*-isSemiringWithoutAnnihilatingZero
9191
```
9292

93+
* `Data.List.Relation.Unary.Any.any` to `Data.List.Relation.Unary.Any.any?`
94+
* `Data.List.Relation.Unary.All.all` to `Data.List.Relation.Unary.All.all?`
95+
* `Data.Vec.Relation.Unary.Any.any` to `Data.Vec.Relation.Unary.Any.any?`
96+
* `Data.Vec.Relation.Unary.All.all` to `Data.Vec.Relation.Unary.All.all?`
97+
9398
New modules
9499
-----------
95100

src/Data/List/Countdown.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ emptyFromList counted complete = empty record
149149
-- Finds out if an element has been counted yet.
150150

151151
lookup : {counted n} counted ⊕ n x Dec (x ∈ counted)
152-
lookup {counted} _ x = Any.any (_≟_ x) counted
152+
lookup {counted} _ x = Any.any? (_≟_ x) counted
153153

154154
-- When no element remains to be counted all elements have been
155155
-- counted.

src/Data/List/Membership/DecSetoid.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open import Relation.Binary using (Decidable; DecSetoid)
1010

1111
module Data.List.Membership.DecSetoid {a ℓ} (DS : DecSetoid a ℓ) where
1212

13-
open import Data.List.Relation.Unary.Any using (any)
13+
open import Data.List.Relation.Unary.Any using (any?)
1414
open DecSetoid DS
1515

1616
------------------------------------------------------------------------
@@ -24,4 +24,4 @@ open import Data.List.Membership.Setoid (DecSetoid.setoid DS) public
2424
infix 4 _∈?_
2525

2626
_∈?_ : Decidable _∈_
27-
x ∈? xs = any (x ≟_) xs
27+
x ∈? xs = any? (x ≟_) xs

src/Data/List/Relation/Unary/All.agda

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ module _ {P : Pred A p} where
212212

213213
module _ {P : Pred A p} where
214214

215-
all : Decidable P Decidable (All P)
216-
all p [] = yes []
217-
all p (x ∷ xs) = Dec.map′ (uncurry _∷_) uncons (p x ×-dec all p xs)
215+
all? : Decidable P Decidable (All P)
216+
all? p [] = yes []
217+
all? p (x ∷ xs) = Dec.map′ (uncurry _∷_) uncons (p x ×-dec all? p xs)
218218

219219
universal : Universal P Universal (All P)
220220
universal u [] = []
@@ -227,3 +227,9 @@ module _ {P : Pred A p} where
227227

228228
satisfiable : Satisfiable (All P)
229229
satisfiable = [] , []
230+
231+
all = all?
232+
{-# WARNING_ON_USAGE all
233+
"Warning: all was deprecated in v1.4.
234+
Please use all? instead."
235+
#-}

src/Data/List/Relation/Unary/AllPairs.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module _ {s} {S : Rel A s} where
7171
allPairs? : B.Decidable R U.Decidable (AllPairs R)
7272
allPairs? R? [] = yes []
7373
allPairs? R? (x ∷ xs) =
74-
Dec.map′ (uncurry _∷_) uncons (All.all (R? x) xs ×-dec allPairs? R? xs)
74+
Dec.map′ (uncurry _∷_) uncons (All.all? (R? x) xs ×-dec allPairs? R? xs)
7575

7676
irrelevant : B.Irrelevant R U.Irrelevant (AllPairs R)
7777
irrelevant irr [] [] = refl

src/Data/List/Relation/Unary/Any.agda

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,15 @@ module _ {P : Pred A p} {x xs} where
9494

9595
module _ {P : Pred A p} where
9696

97-
any : Decidable P Decidable (Any P)
98-
any P? [] = no λ()
99-
any P? (x ∷ xs) = Dec.map′ fromSum toSum (P? x ⊎-dec any P? xs)
97+
any? : Decidable P Decidable (Any P)
98+
any? P? [] = no λ()
99+
any? P? (x ∷ xs) = Dec.map′ fromSum toSum (P? x ⊎-dec any? P? xs)
100100

101101
satisfiable : Satisfiable P Satisfiable (Any P)
102102
satisfiable (x , Px) = [ x ] , here Px
103+
104+
any = any?
105+
{-# WARNING_ON_USAGE any
106+
"Warning: any was deprecated in v1.4.
107+
Please use any? instead."
108+
#-}

src/Data/List/Relation/Unary/Grouped.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module Data.List.Relation.Unary.Grouped where
1010

1111
open import Data.List using (List; []; _∷_; map)
12-
open import Data.List.Relation.Unary.All as All using (All; []; _∷_; all)
12+
open import Data.List.Relation.Unary.All as All using (All; []; _∷_; all?)
1313
open import Data.Sum using (_⊎_; inj₁; inj₂)
1414
open import Data.Product using (_×_; _,_)
1515
open import Relation.Binary as B using (REL; Rel)
@@ -32,7 +32,7 @@ module _ {a ℓ} {A : Set a} {_≈_ : Rel A ℓ} where
3232
grouped? : B.Decidable _≈_ U.Decidable (Grouped _≈_)
3333
grouped? _≟_ [] = yes []
3434
grouped? _≟_ (x ∷ []) = yes ([] ∷≉ [])
35-
grouped? _≟_ (x ∷ y ∷ xs) = map′ from to ((x ≟ y ⊎-dec all (λ z ¬? (x ≟ z)) (y ∷ xs)) ×-dec (grouped? _≟_ (y ∷ xs))) where
35+
grouped? _≟_ (x ∷ y ∷ xs) = map′ from to ((x ≟ y ⊎-dec all? (λ z ¬? (x ≟ z)) (y ∷ xs)) ×-dec (grouped? _≟_ (y ∷ xs))) where
3636
from : ((x ≈ y) ⊎ All (λ z ¬ (x ≈ z)) (y ∷ xs)) × Grouped _≈_ (y ∷ xs) Grouped _≈_ (x ∷ y ∷ xs)
3737
from (inj₁ x≈y , grouped[y∷xs]) = x≈y ∷≈ grouped[y∷xs]
3838
from (inj₂ all[x≉,y∷xs] , grouped[y∷xs]) = all[x≉,y∷xs] ∷≉ grouped[y∷xs]

src/Data/Vec/Membership/DecSetoid.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ open import Relation.Binary using (DecSetoid)
1111
module Data.Vec.Membership.DecSetoid {c ℓ} (DS : DecSetoid c ℓ) where
1212

1313
open import Data.Vec.Base using (Vec)
14-
open import Data.Vec.Relation.Unary.Any using (any)
14+
open import Data.Vec.Relation.Unary.Any using (any?)
1515
open import Relation.Nullary using (Dec)
1616
open DecSetoid DS renaming (Carrier to A)
1717

@@ -26,4 +26,4 @@ open import Data.Vec.Membership.Setoid setoid public
2626
infix 4 _∈?_
2727

2828
_∈?_ : x {n} (xs : Vec A n) Dec (x ∈ xs)
29-
x ∈? xs = any (x ≟_) xs
29+
x ∈? xs = any? (x ≟_) xs

src/Data/Vec/Relation/Unary/All.agda

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ module _ {P : Pred A p} {Q : Pred B q} {R : Pred C r} where
8888

8989
module _ {P : Pred A p} where
9090

91-
all : {n} Decidable P Decidable (All P {n})
92-
all P? [] = yes []
93-
all P? (x ∷ xs) = Dec.map′ (uncurry _∷_) uncons (P? x ×-dec all P? xs)
91+
all? : {n} Decidable P Decidable (All P {n})
92+
all? P? [] = yes []
93+
all? P? (x ∷ xs) = Dec.map′ (uncurry _∷_) uncons (P? x ×-dec all? P? xs)
9494

9595
universal : Universal P {n} Universal (All P {n})
9696
universal u [] = []
@@ -104,3 +104,9 @@ module _ {P : Pred A p} where
104104
satisfiable : Satisfiable P {n} Satisfiable (All P {n})
105105
satisfiable (x , p) {zero} = [] , []
106106
satisfiable (x , p) {suc n} = Prod.map (x ∷_) (p ∷_) (satisfiable (x , p))
107+
108+
all = all?
109+
{-# WARNING_ON_USAGE all
110+
"Warning: all was deprecated in v1.4.
111+
Please use all? instead."
112+
#-}

src/Data/Vec/Relation/Unary/AllPairs.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module _ {s} {S : Rel A s} where
7171
allPairs? : {n} B.Decidable R U.Decidable (AllPairs R {n})
7272
allPairs? R? [] = yes []
7373
allPairs? R? (x ∷ xs) =
74-
Dec.map′ (uncurry _∷_) uncons (All.all (R? x) xs ×-dec allPairs? R? xs)
74+
Dec.map′ (uncurry _∷_) uncons (All.all? (R? x) xs ×-dec allPairs? R? xs)
7575

7676
irrelevant : {n} B.Irrelevant R U.Irrelevant (AllPairs R {n})
7777
irrelevant irr [] [] = refl

0 commit comments

Comments
 (0)