For:

instance (Ord a) => Max a where
 maximum = max

The same could more simply be achieved with a function:

maximum :: Ord a => a
maximum = max

Now, you probably wanted both a base-case using max and type specific,
special cases:

instance Max Int where
  maximum = 2^16

If you have both instances defined in the same module, GHC should
always pick the special case for Int if overlapping instances is
turned on. However, I've never found a description of how it resolves
instance selection if you have the specialized cases in different
modules. Unspecified [*] behaviour is not something I'd want to rely
on, so I always avoid Overlapping Instances.


[*] Of course, the multiple module behaviour might be specified somewhere...

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to