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
+10
View File
@@ -0,0 +1,10 @@
module Dodge.Base.Arithmetic where
import MaybeHelp
decreaseToZero :: Int -> Int
decreaseToZero = max 0 . subtract 1
decreaseToNothing' :: (Num a, Ord a) => Maybe' a -> Maybe' a
decreaseToNothing' ma = case ma of
Just' x | x > 0 -> Just' (x - 1)
_ -> Nothing'