[Haskell-cafe] hiding instance definitions in imported modules or redefining them, can it be done?

John Lask jvlask at hotmail.com
Fri Jul 3 04:13:42 EDT 2009


Is there a way to hide instance definitions when importing a module for 
instance

I want to import Data.Monoid but wish to redefine the instance of Monoid for 
( a->b)

I don't suppose this is possible?

 Specifically, I wish to define a specialised instance of Monoid for 
String->Int, but it seems overlapping instances will not give me what I 
want, as this option seems to need to be applied at the definition site (aka 
Data.Monoid module, looking for confirmation of this?).

The easy fix is just to do newtype M a b = M (a->b) etc..., but I was 
hopping to avoid this. I've encountered this issue several times. Why can't 
we redefine instances? I can't of thought that there are any seriouse 
technical issues in doing so? If so what are they?


jvl 



More information about the Haskell-Cafe mailing list