
Hi, Am Dienstag, den 24.02.2015, 14:00 +0000 schrieb Jake McArthur:
+1 do all instances of the proposal. It is so common for me to want to use some polymorphic function but it not be available to me because it has a constraint not satisfied by a newtype wrapper around the type I want to use it with, so I have to write a bunch of boilerplate. I think we should eliminate such boilerplate aggressively. I even think Applicative and Monad would be useful. Just because a wrapper doesn't add behavior doesn't mean we should intentionally make it incompatible with so much code.
your argument is valid: If I have a, say, "Num a", then I’d like to be able to (+) also on values of type "Sum a". Hence the instance Num a => Num (Sum a) and others of that kind (Eq, Ord, Read, Show). But your argument does not apply to the question at hand. The "Monad Sum" instance is not of the „the instance of the wrapped thing lifted to the newtype wrapper“ kind (as the wrapped thing has kind * and thus is not a monad). Rather, it is the „there is only one only lawful Monad instance for Identity, and Sum is isomorphic to Identity, so let’s use it here“. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org