Let's start by looking at the type of Error
:
Error :: String -> E a
That means that for any a
type, you can get an E a
by using something like Error "foo"
. However, each specific Error "foo"
value has to choose a specific a
, and you can't change it afterwards. So Error "foo" :: E Int
is not the same as Error "foo" :: E String
.
So in your specific example, e
is referring to the actual "original" Error s
value, of type E a
, whereas in the alternative formulation you are constructing a new Error s
value, which type inference forces to have type E b
.