We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Data.List.Base.unfold
with
1 parent 69bbe51 commit 90db673Copy full SHA for 90db673
src/Data/List/Base.agda
@@ -250,9 +250,7 @@ unfold : ∀ (P : ℕ → Set b)
250
(f : ∀ {n} → P (suc n) → Maybe (A × P n)) →
251
∀ {n} → P n → List A
252
unfold P f {n = zero} s = []
253
-unfold P f {n = suc n} s with f s
254
-... | nothing = []
255
-... | 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)
256
257
------------------------------------------------------------------------
258
-- Operations for reversing lists
0 commit comments