
On Wed, Dec 11, 2013 at 10:48 PM, Danny Gratzer
This seems to work
{-# LANGUAGE FlexibleInstances #-} instance Num (a -> a) where (*) = (.)
Of course, using anything else from the Num class will blow up in your face so it's probably not worth it.
And the hidden danger is that Num is special cased such that the compiler more or less has an open license to infer Num instances all over the place (see: defaulting, and its interaction with the monomorphism restriction), and as a result it will infer things you would never have imagined. In other words, the price of this is that type inference is no longer reliable and type errors will be reported incomprehensibly, depending on how consistently you specify type signatures (that is, the more you have, the more comprehensible the errors; but few people actually use type signatures *everywhere* they can be specified). -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net