can the default instances in GHC be recompiled with overlap?

Per the GHC manual section on instance overlap: If an instance declaration is compiled without -XOverlappingInstances, then that instance can never be overlapped. This could perhaps be inconvenient. It is inconvenient for certain things. If I want to declare a special `instance Show [MyType] where...` I am out of luck. However, the solution need not involve a change to the way instances are handled -- if all the `GHC.*` instances were compiled with overlapping instances, I'd be able to declare my instance. Is there a substantial barrier, either theoretical or practical, to recompiling GHC this way? -- _jsn |...GHC manual section...| http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extension...

On Aug 25, 2008, at 15:00 , Jason Dusek wrote:
It is inconvenient for certain things. If I want to declare a special `instance Show [MyType] where...` I am out of luck.
In this particular case, can't you just define showList? -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Brandon S. Allbery KF8NH
Jason Dusek wrote:
It is inconvenient for certain things. If I want to declare a special `instance Show [MyType] where...` I am out of luck.
In this particular case, can't you just define showList?
Will GHCi use that automatically? Probably not... Nor can I write nice codez with print, printf, &c. I have to use my silly function now. I want to be in the Show typeclass for clarity as well as convenience. -- _jsn

On Mon, 2008-08-25 at 15:44 -0700, Jason Dusek wrote:
Brandon S. Allbery KF8NH
wrote: Jason Dusek wrote:
It is inconvenient for certain things. If I want to declare a special `instance Show [MyType] where...` I am out of luck.
In this particular case, can't you just define showList?
Will GHCi use that automatically? Probably not... Nor can I write nice codez with print, printf, &c. I have to use my silly function now. I want to be in the Show typeclass for clarity as well as convenience.
showList is a method of the Show type class... http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v% 3AshowList jcc

Oh! Thank you -- that turned out to be the right thing. I'm glad someone thought of this already. -- _jsn
participants (3)
-
Brandon S. Allbery KF8NH
-
Jason Dusek
-
Jonathan Cast