| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Booleans: conjunction and disjunction of lists |
| 5 |
-- |
| 6 |
-- Issue #2553: this is a compatibility stub module, |
| 7 |
-- ahead of a more thorough refactoring in terms of |
| 8 |
-- `Data.List.Effectful.Foldable.foldmap`. |
| 9 |
------------------------------------------------------------------------ |
| 10 |
|
| 11 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 12 |
|
| 13 |
module Data.Bool.ListAction where |
| 14 |
|
| 15 |
open import Data.Bool.Base using (Bool; _∧_; _∨_; true; false) |
| 16 |
open import Data.List.Base using (List; map; foldr) |
| 17 |
open import Function.Base using (_∘_) |
| 18 |
open import Level using (Level) |
| 19 |
|
| 20 |
private |
| 21 |
variable |
| 22 |
a : Level |
| 23 |
A : Set a |
| 24 |
|
| 25 |
|
| 26 |
------------------------------------------------------------------------ |
| 27 |
-- Definitions |
| 28 |
|
| 29 |
and : List Bool → Bool |
| 30 |
and = foldr _∧_ true |
| 31 |
|
| 32 |
or : List Bool → Bool |
| 33 |
or = foldr _∨_ false |
| 34 |
|
| 35 |
any : (A → Bool) → List A → Bool |
| 36 |
any p = or ∘ map p |
| 37 |
|
| 38 |
all : (A → Bool) → List A → Bool |
| 39 |
all p = and ∘ map p |
| 40 |
|