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

View: New views
2 Messages — Rating Filter:   Alert me  

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

by John Lask :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Maurí­cio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

No, there isn't. See item 5.4:

http://haskell.org/onlinereport/modules.html


Best,
Maurício

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