« Return to Thread: hiding instance definitions in imported modules or redefining them, can it be done?

hiding instance definitions in imported modules or redefining them, can it be done?

by John Lask :: Rate this Message:

Reply to Author | View in Thread

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

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

 « Return to Thread: hiding instance definitions in imported modules or redefining them, can it be done?