[GHC] #6150: Nested instances
GHC
cvs-ghc at haskell.org
Fri Jun 8 10:02:12 CEST 2012
#6150: Nested instances
-------------------------------+--------------------------------------------
Reporter: exFalso | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.1
Resolution: invalid | Keywords: DataKinds, typeclass, nested
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Changes (by simonpj):
* status: new => closed
* difficulty: => Unknown
* resolution: => invalid
Comment:
Lots of reasons not to do this:
* You propose to give `printBool` this type
{{{
printBool :: Proxy (b :: Bool) -> IO ()
}}}
but it really is not as polymorphic as that, and the "free theorems"
won't hold. The class restriction tells you that the polymorphism is not
parametric.
* GHC uses "evidence passing" to implement type classes. That means that
even in your example, `printBool` must take a hidden value parameter,
which is the dictionary of methods for `SomeClass`. So if you suppressed
it from the visible type, it would still have to be present in the real
type.
* In your example the instances occur right with the class declaration.
But what if they don't. Then in some places you'd see it as exhaustive and
in some not.
Sorry, but I don't think this is a runner.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6150#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list