type synonym families are treated as being able to be instance of a class
The following code doesn’t compile:
{-# LANGUAGE TypeFamilies #-}
module TypeFamilyBug where
type family TestFamily a :: *
type instance TestFamily () = [()]
testFunction :: value -> TestFamily value -> ()
testFunction = const (const ())
testApplication :: ()
testApplication = testFunction () (return ())
GHC 6.8.20070916 complains about TestFamily
not being an instance of Monad
. Obviously, GHC recognizes that the second argument in the application of testApplication
has to be of type TestFamily ()
and tries to unify this type with m ()
from the type of return
. However, in my opinion, GHC should reduce TestFamily ()
to [()]
and then see that the []
is the type which has to be an instance of Monad
.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | g9ks157k@acme.softbase.org |
Operating system | |
Architecture |