
1 Mar
2015
1 Mar
'15
9:07 a.m.
A tiny nitpick: you can get a total function if you return a default value instead of erroring out.
What default value would you return for the function `Maybe a -> a`?
You can do it with unsafeCoerce, but there are restrictions. And that's not what I meant, sorry. I mentally substituted an a for an Int: f :: Maybe Int -> Int f (Just x) = x f Nothing = 0 And there's also the maybe function.