Allow for partial reloading

This commit is contained in:
2021-12-01 17:40:09 +00:00
parent d75ea2b252
commit 016a1faf80
21 changed files with 181 additions and 143 deletions
+5
View File
@@ -38,6 +38,11 @@ takeUntil p = foldr (\x xs -> x : if p x then [] else xs) []
decreaseToZero :: Int -> Int
decreaseToZero x = max 0 (x - 1)
decreaseToNothing' :: (Num a, Ord a) => Maybe' a -> Maybe' a
decreaseToNothing' ma = case ma of
Just' x | x > 0 -> Just' (x - 1)
_ -> Nothing'
safeHead :: [a] -> Maybe a
safeHead (x:_) = Just x
safeHead _ = Nothing