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

Silvio Frischknecht silvio.frischi at gmail.com
Thu Aug 2 07:47:31 UTC 2018


Haskell does something implicit that you can't see.

f :: a -> b

really means

f :: forall a. forall b. a -> b

I think this is called universal quantification.

It's like a c++ template.

template<typename a, typename b>
b function(a x) { return x; }

So there needs to be a function f forall a and b. I can choose a=Int,
b=Char which is impossible with

f a = a

Cheers

Silvio



More information about the Haskell-Cafe mailing list