11 lines
270 B
Haskell
11 lines
270 B
Haskell
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'
|