[GHC] #8357: Pretty printing of kind-involving inferred types
#8357: Pretty printing of kind-involving inferred types ------------------------------------+------------------------------------- Reporter: ksf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- An example of inferred types (foo, bar, both), for brevity's sake omitting value-level details: {{{ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeOperators #-} import GHC.TypeLits data (:::) (sy :: Symbol) ty data Key (sy :: Symbol) data Rec (rs :: [*]) (*=) :: Key sy -> ty -> Rec '[sy ::: ty] (*=) = undefined (.*.) :: (Union xs ys ~ rs) => Rec xs -> Rec ys -> Rec rs (.*.) = undefined type family Union (xs :: [*]) (ys :: [*]) :: [*] where Union ((sy ::: t) ': xs) ys = (sy ::: t) ': Union xs ys Union '[] ys = ys fFoo :: Key "foo" fFoo = undefined fBar :: Key "bar" fBar = undefined foo :: Rec ((':) * ("foo" ::: [Char]) ('[] *)) foo = fFoo *= "foo" bar :: Rec ((':) * ("bar" ::: [Char]) ('[] *)) bar = fBar *= "bar" both :: Rec ((':) * ("foo" ::: [Char]) ((':) * ("bar" ::: [Char]) ('[] *))) both = foo .*. bar }}} There's actually two issues, here: First, the most serious one, GHC prints kind annotations (*) that it can't even parse back, and then [*] types are pretty printed with ': constructors instead of nicely with [,] syntax. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8357> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8357: Pretty printing of kind-involving inferred types -------------------------------------+------------------------------------ Reporter: ksf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonpj): This commit improves matters a lot {{{ commit 66c5ddba449e78a174e989ea35783eb6c793e483 Author: unknown <simonpj@MSRC-4971295.europe.corp.microsoft.com> Date: Tue Oct 1 16:34:00 2013 +0100 Improve pretty-printing of types * The main change is to suppress printing (in types) of kind for-alls kind applications The new flag -fprint-explicit-kinds prints them as before (by analogy with the existing -fprint-explicit-foralls) * I also took advantage of the fact that SDoc now has access to DynFlags, to tidy up the way in which explicit for-alls are printed. Instead of passing a boolean flag around, we now simply consult the DynFlags. Much neater. I still need to add documentation for the flag }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8357#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8357: Pretty printing of kind-involving inferred types -------------------------------------+------------------------------------ Reporter: ksf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:06afa916d4f76e58903bdf133567d28499780f68/testsuite]: {{{ #!CommitTicketReference repository="testsuite" revision="06afa916d4f76e58903bdf133567d28499780f68" Test Trac #8357 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8357#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8357: Pretty printing of kind-involving inferred types -------------------------------------+------------------------------------ Reporter: ksf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonpj): Actually I did do the documentation too, in {{{ commit 63f2eee8908e26779c73365ef3c58ade2b73fb6a Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Tue Oct 1 19:18:27 2013 +0100 Documentation for -fprint-explicit-foralls and -fprint-explicit-kinds Plus a tidy-up of the flag documentation in the immediate area docs/users_guide/flags.xml | 175 +++++++++++++++++++++++--------------------- docs/users_guide/using.xml | 41 ++++++++++- 2 files changed, 132 insertions(+), 84 deletions(-) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8357#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8357: Pretty printing of kind-involving inferred types ---------------------------------------+----------------------------------- Reporter: ksf | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: ghci/scripts/T8357 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by simonpj): * status: new => closed * testcase: => ghci/scripts/T8357 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8357#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC