Those are not demonstrations of the defaulting rules in action though.

As far as I know, :t is agnostic to those and will keep showing the original polymorphic version, since you're not in a context where GHC has to sacrifice the polymorphic type and commit to a monomorphic one using a default, like when expressions are evaluated.

Also I think that's effective just for the REPL (it uses extended defaulting rules that are more lax) and is done for convenience. If it was during a GHC build, you'd get loud warning when something is defaulted.

Try `reverse []` for fun vs. `:t reverse []`.


On Sep 29, 2016 7:48 PM, "Lai Boon Hui" <laiboonh@gmail.com> wrote:
Hi,
i read that the default type for Num is Integer.
If we specify a type for one of the arguments:
:t (1 + 1::Double) is Double

If we don't, i expect the default type for Num to come into play:
However :t (1 + 1) is Num a => a

Why is that so?

--
Best Regards,
Boon Hui

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners