[Haskell-cafe] why different type variables enforce different types?

Rui Azevedo ruihfazevedo at gmail.com
Wed Aug 1 05:49:22 UTC 2018


after using haskell for a while i was surprised by this little thing

f::a->b
f a=a

and this is not making sense to me till now, so please can someone 
enlighten me, why does haskell assume that b can not be the same type of a?

after all having two distinct math variables does not mean they can not 
have the same value.

I know i could use f::a->a, but its not the same thing, on this last 
case I'm requesting them to be the same type, but on the first I'm not 
forbidding it, is there a math reason behind it?

would type inference be rendered impossible if considering the case of 
them being equal?

thanks

Rui Azevedo (neu-rah)



More information about the Haskell-Cafe mailing list