Refactor creature zoning

This commit is contained in:
2022-07-22 17:53:08 +01:00
parent 43e7d20b21
commit 39f4555697
17 changed files with 209 additions and 85 deletions
+6
View File
@@ -8,6 +8,7 @@ module FoldableHelp
, filter3
, takeUntil
, ssfold
, minOn
, module Data.Foldable
)
where
@@ -29,6 +30,11 @@ safeMinimumOn f = foldl' g Nothing
| f x < f y = Just x
| otherwise = Just y
g Nothing y = Just y
minOn :: Ord b => (a -> b) -> a -> a -> a
minOn f x y
| f x < f y = x
| otherwise = y
safeMinimumOnMaybeF :: (Ord b) => (a -> Maybe b) -> [a] -> Maybe a
safeMinimumOnMaybeF f = L.fold $ L.Fold step initial extract
where