Split Dodge.Base

This commit is contained in:
2022-06-19 11:34:59 +01:00
parent 6cc29813d8
commit df1f3ad6b0
15 changed files with 106 additions and 88 deletions
+7
View File
@@ -6,6 +6,7 @@ module FoldableHelp
, safeMinimumOnMaybeL
, safeMinMaybeL
, filter3
, takeUntil
, module Data.Foldable
)
where
@@ -82,3 +83,9 @@ filter3 t1 t2 t3 = L.fold $ (,,)
-- go x (y:xs) | f x < f y = go x xs
-- | otherwise = go y xs
-- go x [] = x
{- | Implementation copied from
- https://hackage.haskell.org/package/utility-ht-0.0.16/docs/src/Data.List.HT.Private.html#takeUntil
-}
takeUntil :: Foldable t => (a -> Bool) -> t a -> [a]
takeUntil p = foldr (\x xs -> x : if p x then [] else xs) []