File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -421,9 +421,10 @@ linesBy {A = A} P? = go nothing where
421421
422422 go : Maybe (List A) → List A → List (List A)
423423 go acc [] = maybe′ ([_] ∘′ reverse) [] acc
424- go acc (c ∷ cs) with does (P? c)
425- ... | true = reverse (Maybe.fromMaybe [] acc) ∷ go nothing cs
426- ... | false = go (just (c ∷ Maybe.fromMaybe [] acc)) cs
424+ go acc (c ∷ cs) = if does (P? c)
425+ then reverse acc′ ∷ go nothing cs
426+ else go (just (c ∷ acc′)) cs
427+ where acc′ = Maybe.fromMaybe [] acc
427428
428429linesByᵇ : (A → Bool) → List A → List (List A)
429430linesByᵇ p = linesBy (T? ∘ p)
@@ -441,9 +442,9 @@ wordsBy {A = A} P? = go [] where
441442
442443 go : List A → List A → List (List A)
443444 go acc [] = cons acc []
444- go acc (c ∷ cs) with does (P? c)
445- ... | true = cons acc (go [] cs)
446- ... | false = go (c ∷ acc) cs
445+ go acc (c ∷ cs) = if does (P? c)
446+ then cons acc (go [] cs)
447+ else go (c ∷ acc) cs
447448
448449wordsByᵇ : (A → Bool) → List A → List (List A)
449450wordsByᵇ p = wordsBy (T? ∘ p)
You can’t perform that action at this time.
0 commit comments