[GHC] #10839: Consistent pretty-printing of type families
#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
#10839: Consistent pretty-printing of type families -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: msosn Type: task | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by msosn): * owner: => msosn -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10839: Consistent pretty-printing of type families -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: msosn Type: task | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Yay @msosn. Thanks! Let us know if you need assistance. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10839: Consistent pretty-printing of type families -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: msosn Type: task | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1441 Wiki Page: | -------------------------------------+------------------------------------- Changes (by msosn): * differential: => Phab:D1441 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10839: Consistent pretty-printing of type families -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: msosn Type: task | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1441 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"c61759d5917996a10b06a286eb5b776e4069e35c/ghc" c61759d/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="c61759d5917996a10b06a286eb5b776e4069e35c" Fix inconsistent pretty-printing of type families After the changes, the three functions used to print type families were identical, so they are refactored into one. Original RHSs of data instance declarations are recreated and printed in user error messages. RHSs containing representation TyCons are printed in the Coercion Axioms section in a typechecker dump. Add vbar to the list of SDocs exported by Outputable. Replace all text "|" docs with it. Fixes #10839 Reviewers: goldfire, jstolarek, austin, bgamari Reviewed By: jstolarek Subscribers: jstolarek, thomie Differential Revision: https://phabricator.haskell.org/D1441 GHC Trac Issues: #10839 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10839: Consistent pretty-printing of type families -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: msosn Type: task | Status: closed Priority: lowest | Milestone: Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1441 Wiki Page: | -------------------------------------+------------------------------------- Changes (by jstolarek): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10839#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC