Refactor creature zoning
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user