#2895: Implement the "Class System Extension" proposal
---------------------------------+------------------------------------------
Reporter: porges | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: _|_
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: proposal | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Changes (by simonpj):
* difficulty: => Unknown
* milestone: => _|_
Comment:
There seems to be a lot of overlap between
* [http://haskell.org/haskellwiki/Class_system_extension_proposal]
* [http://haskell.org/haskellwiki/Superclass_defaults] (Section 1)
* Parts of [http://repetae.net/john/recent/out/classalias.html]
although I don't think they are quite the same. It's hard to be sure
because they are written at very different levels of detail.
I gather that the basic idea is to allow
{{{
class D a where
opD :: ...
class D a => C a where
opC :: ...
opC = ...
opD = ...opC...
instance C Int where
opC = ...
}}}
This leaves me with lots of questions:
* The above instance declaration for C implies an implicit instance
declaration for D:
{{{
instance D Int where
opD = ...opC...
}}}
But what triggers that behaviour? Is it the mere existence of a single
default method for D in the class declaration for C?
* There is no textual clue that we get an instance for D. Shouldn't
there be? As the other proposal suggests, perhaps
{{{
instance (C Int, D Int) where
opC = ...
}}}
But that is bad in another way: now we can't re-factor C into two classes
without changing the instances of C, which was one of John Meacham's
specific goals.
* What if there already is an instance for D? Is that ok? If an
existing explicit instance somehow suppresses the implicit instance, there
is even more going on in invisible implicit-land. What if the explicit
instance was not exactly the same, but merely overlapped?
I think a good way to make the proposal(s) more precise would be to give a
translation into ordinary Haskell. That would answer some of these
questions.
Interesting stuff here, but it needs a bit of work.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2895#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs