[GHC] #10839: Consistent pretty-printing of type families
GHC
ghc-devs at haskell.org
Thu Sep 3 23:43:04 UTC 2015
#10839: Consistent pretty-printing of type families
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner:
Type: task | Status: new
Priority: lowest | Milestone:
Component: Compiler | Version: 7.11
Keywords: newcomer | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Say I have this silly open type family declaration:
{{{#!hs
type family F a
type instance F a = a
type instance F a = Int
}}}
GHC complains:
{{{
Foo.hs:8:15: error:
Conflicting family instance declarations:
F a -- Defined at Foo.hs:8:15
F a -- Defined at Foo.hs:9:15
}}}
Now let's do some silliness with a closed type family:
{{{#!hs
type family F a where
F a = a
F a = Int
}}}
GHC warns:
{{{
T6018.hs:9:5: warning:
Type family instance equation is overlapped:
F a = Int
}}}
Finally, some silliness with a kind-polymorphic type family:
{{{#!hs
type family Gc (a :: k) (b :: k) = r | r -> k where
Gc a b = Int
}}}
GHC complains:
{{{
T6018.hs:9:5: error:
Type family equation violates injectivity annotation.
Injective kind variable ‘k’ is not inferable from the RHS type
variables.
In the RHS of type family equation:
forall (k :: BOX) (a :: k) (b :: k). Gc a b = Int
In the equations for closed type family ‘Gc’
In the type family declaration for ‘Gc’
}}}
There are some inconsistencies in pprinting of type family equations:
* for open type families we print the location where the equation was
defined but we do not print the RHS
* for closed type families we print the RHS but we do not print the
location in the source file
* kind-polymorphic equations are not indented
I would like to have a consistent pretty-printing of type family
equations, one that prints the RHS, source code location and indents kind-
polymorphic equations. The difference in pretty printing between open and
closed type families comes from the difference between pprinting
`CoAxBranch` and `FamInst`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list