This file contains hidden or 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
| _find_ : {A : Set} → List A → (A → Bool) → Option A | |
| [] find _ = None | |
| (x :: xs) find p = if (p x) then (Some x) else (xs find p) |
This file contains hidden or 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
| _mapOption_ : {A : Set} → {B : Set} → Option A → (A → B) → Option B | |
| None mapOption _ = None | |
| (Some a) mapOption f = Some (f a) |
This file contains hidden or 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
| _flatMapOption_ : {A : Set} → {B : Set} → Option A → (A → Option B) → Option B | |
| None flatMapOption _ = None | |
| (Some a) flatMapOption f = f a |
This file contains hidden or 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
| data True : Set where | |
| qed : True | |
| data False : Set where | |
| -- false has no constructors |
This file contains hidden or 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
| moduspoens : {P : Set} → {Q : Set} → P → (P → Q) → Q | |
| moduspoens p imp = imp p |
This file contains hidden or 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
| vacuous : {A : Set} → False → A | |
| vacuous () |
This file contains hidden or 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
| data Even : ℕ → Set where | |
| zeroeven : Even zero | |
| +2even : {n : ℕ} → Even n → Even (succ (succ n)) |
This file contains hidden or 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
| 2even : Even 2 | |
| 2even = +2even zeroeven |
This file contains hidden or 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
| 1odd : Even 1 → False | |
| 1odd () |
This file contains hidden or 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
| data _==_ {A : Set} : A → A → Set where | |
| refl : (a : A) → a == a |