| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Natural numbers: sum and product of lists |
| 5 |
-- |
| 6 |
-- Issue #2553: this is a compatibility stub module, |
| 7 |
-- ahead of a more thorough breaking set of changes. |
| 8 |
------------------------------------------------------------------------ |
| 9 |
|
| 10 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 11 |
|
| 12 |
module Data.Nat.ListAction where |
| 13 |
|
| 14 |
open import Data.List.Base using (List; []; _∷_; _++_; foldr) |
| 15 |
open import Data.Nat.Base using (ℕ; _+_; _*_) |
| 16 |
|
| 17 |
|
| 18 |
------------------------------------------------------------------------ |
| 19 |
-- Definitions |
| 20 |
|
| 21 |
sum : List ℕ → ℕ |
| 22 |
sum = foldr _+_ 0 |
| 23 |
|
| 24 |
product : List ℕ → ℕ |
| 25 |
product = foldr _*_ 1 |