-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upstream classes from
iog-agda-prelude
- Loading branch information
Showing
12 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Class.Allable where | ||
|
||
open import Class.Allable.Core public | ||
open import Class.Allable.Instance public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Class.Allable.Core where | ||
|
||
open import Class.Prelude | ||
|
||
record Allable (F : Set ℓ → Set ℓ) : Set (lsuc ℓ) where | ||
field All : ∀ {A} → (A → Set) → F A → Set ℓ | ||
|
||
∀∈-syntax = All | ||
∀∈-syntax′ = All | ||
¬∀∈-syntax = λ {A} P → ¬_ ∘ All {A} P | ||
¬∀∈-syntax′ = ¬∀∈-syntax | ||
infix 2 ∀∈-syntax ∀∈-syntax′ ¬∀∈-syntax ¬∀∈-syntax′ | ||
syntax ∀∈-syntax P xs = ∀[∈ xs ] P | ||
syntax ∀∈-syntax′ (λ x → P) xs = ∀[ x ∈ xs ] P | ||
syntax ¬∀∈-syntax P xs = ¬∀[∈ xs ] P | ||
syntax ¬∀∈-syntax′ (λ x → P) xs = ¬∀[ x ∈ xs ] P | ||
|
||
open Allable ⦃...⦄ public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Class.Allable.Instance where | ||
|
||
open import Class.Prelude | ||
open import Class.Allable.Core | ||
|
||
import Data.List.Relation.Unary.All as L | ||
import Data.Vec.Relation.Unary.All as V | ||
import Data.Maybe.Relation.Unary.All as M | ||
|
||
instance | ||
Allable-List : Allable {ℓ} List | ||
Allable-List .All = L.All | ||
|
||
Allable-Vec : ∀ {n} → Allable {ℓ} (flip Vec n) | ||
Allable-Vec .All P = V.All P | ||
|
||
Allable-Maybe : Allable {ℓ} Maybe | ||
Allable-Maybe .All = M.All | ||
|
||
private | ||
open import Class.Decidable | ||
open import Class.HasOrder | ||
|
||
_ : ∀[ x ∈ List ℕ ∋ 1 ∷ 2 ∷ 3 ∷ [] ] x > 0 | ||
_ = auto | ||
|
||
_ : ∀[ x ∈ just 42 ] x > 0 | ||
_ = auto | ||
|
||
_ : ∀[ x ∈ nothing ] x > 0 | ||
_ = auto | ||
|
||
_ : ¬∀[ x ∈ just 0 ] x > 0 | ||
_ = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Class.Anyable where | ||
|
||
open import Class.Anyable.Core public | ||
open import Class.Anyable.Instance public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Class.Anyable.Core where | ||
|
||
open import Class.Prelude | ||
|
||
record Anyable (F : Set ℓ → Set ℓ) : Set (lsuc ℓ) where | ||
field Any : ∀ {A} → (A → Set) → F A → Set ℓ | ||
|
||
∃∈-syntax = Any | ||
∃∈-syntax′ = Any | ||
∄∈-syntax = λ {A} P → ¬_ ∘ Any {A} P | ||
∄∈-syntax′ = ∄∈-syntax | ||
infix 2 ∃∈-syntax ∃∈-syntax′ ∄∈-syntax ∄∈-syntax′ | ||
syntax ∃∈-syntax P xs = ∃[∈ xs ] P | ||
syntax ∃∈-syntax′ (λ x → P) xs = ∃[ x ∈ xs ] P | ||
syntax ∄∈-syntax P xs = ∄[∈ xs ] P | ||
syntax ∄∈-syntax′ (λ x → P) xs = ∄[ x ∈ xs ] P | ||
|
||
open Anyable ⦃...⦄ public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Class.Anyable.Instance where | ||
|
||
open import Class.Prelude | ||
open import Class.Anyable.Core | ||
|
||
import Data.List.Relation.Unary.Any as L | ||
import Data.Vec.Relation.Unary.Any as V | ||
import Data.Maybe.Relation.Unary.Any as M | ||
|
||
instance | ||
Anyable-List : Anyable {ℓ} List | ||
Anyable-List .Any = L.Any | ||
|
||
Anyable-Vec : ∀ {n} → Anyable {ℓ} (flip Vec n) | ||
Anyable-Vec .Any P = V.Any P | ||
|
||
Anyable-Maybe : Anyable {ℓ} Maybe | ||
Anyable-Maybe .Any = M.Any | ||
|
||
private | ||
open import Class.Decidable | ||
open import Class.HasOrder | ||
|
||
_ : ∃[ x ∈ List ℕ ∋ 1 ∷ 2 ∷ 3 ∷ [] ] x > 0 | ||
_ = auto | ||
|
||
_ : ∃[ x ∈ just 42 ] x > 0 | ||
_ = auto | ||
|
||
_ : ∄[ x ∈ nothing ] x > 0 | ||
_ = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters