Hi there, after a while, I’ve started studying Haskell again and now I’m on exception part
And my question is following: why if I do fromException with SomeException or ArithException I get the same answer "Just divide by zero"
x = toException DivideByZero
fromException @ArithException x -- Just divide by zero
fromException @SomeException x -- Just divide by zero
but if I write directly the same one code, I get Nothing with SomeException
x = toException DivideByZero
f :: Exception e => SomeException -> Maybe e
f = \ (SomeException e) -> cast e
f @ArithException x -- Just divide by zero
f @SomeException x -- Nothing
here are definitions
fromException :: Exception e => SomeException -> Maybe e
fromException (SomeException e) = cast e
f :: Exception e => SomeException -> Maybe e
f = \ (SomeException e) -> cast e
maybe I missed something? but I’m truly can’t understand why is that
your answers, will help me in an immense way
sorry for English, if so - it’s not my native