Skip to content

Commit

Permalink
Improve Data.List.Base.unfold (#2359; deprecate use of with #2123) (
Browse files Browse the repository at this point in the history
#2364)

* `with`-free definition of `unfold`

* fixed previous commit
  • Loading branch information
jamesmckinna authored and andreasabel committed Jul 10, 2024
1 parent d6ea9bc commit 9148fa5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Data/List/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,7 @@ unfold : ∀ (P : ℕ → Set b)
(f : {n} P (suc n) Maybe (A × P n))
{n} P n List A
unfold P f {n = zero} s = []
unfold P f {n = suc n} s with f s
... | nothing = []
... | just (x , s′) = x ∷ unfold P f s′
unfold P f {n = suc n} s = maybe′ (λ (x , s′) x ∷ unfold P f s′) [] (f s)

------------------------------------------------------------------------
-- Operations for reversing lists
Expand Down

0 comments on commit 9148fa5

Please sign in to comment.