Challenge 2: A Hand-Rolled Maybe and a Safe Division Function — Possible Solution ==================================================================== Main.hs: data MyMaybe a = MyNothing | MyJust a deriving (Show) safeDivide :: Int -> Int -> MyMaybe Int safeDivide _ 0 = MyNothing safeDivide x y = MyJust (x `div` y) main :: IO () main = do print (safeDivide 10 2) print (safeDivide 10 0) Output: MyJust 5 MyNothing Explanation: MyMaybe a is defined with the exact same shape the chapter shows for the real Maybe a -- a "nothing" constructor with no data, and a "just" constructor wrapping one value of type a. safeDivide pattern- matches specifically on a divisor of 0 first (using _ to discard the first argument's value, since it isn't relevant to that case), returning MyNothing instead of letting a real division-by-zero exception occur. Any other divisor falls through to the second equation, wrapping the real division result in MyJust. WHY THIS WORKS AS AN ANSWER ------------------------------ This reimplements Maybe's exact shape under a new name and uses it for a genuinely meaningful purpose -- representing "division might fail" directly in the type, the same real-world use case Maybe (and, per the chapter, Rust's own Option) exists to solve.