benefits of matching in functional programming code example
Example 1: benefits of matching in functional programming
if canRunOperationOn someData
then putStrLn ("The operation was successful: " ++ doRunOperationOn someData)
else putStrLn "The operation failed!"
Example 2: benefits of matching in functional programming
case runOperationOn someData of
Just res -> putStrLn ("The operation was successful: " ++ res)
Nothing -> putStrLn "The operation failed!"