[GHC] #14796: Pretty-printer bug

#14796: Pretty-printer bug -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]: {{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}} When instantiating types using `-XTypeApplications` something weird happens {{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}} Doesn't seem to happen in other cases: {{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] () Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty-printer bug -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by Iceland_jack: Old description:
From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]:
{{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}}
When instantiating types using `-XTypeApplications` something weird happens
{{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}}
Doesn't seem to happen in other cases:
{{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] ()
Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}}
New description: From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]: {{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}} When instantiating the `Constraint` using `-XTypeApplications` something weird happens {{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}} Doesn't seem to happen in other cases: {{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] () Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty-printer bug -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): Ryan had trouble reproducing it so here it is for 8.2.1 {{{ $ ghci-8.2.1 -ignore-dot-ghci GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @() @[] @() ECC @() @[] @() :: [()] -> ECC () :: Constraint [] () }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * cc: TypeApplications (removed) * cc: Calanz (added) * keywords: => TypeApplications Old description:
From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]:
{{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}}
When instantiating the `Constraint` using `-XTypeApplications` something weird happens
{{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}}
Doesn't seem to happen in other cases:
{{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] ()
Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}}
New description: From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]: {{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}} When instantiating the `Constraint` using `-XTypeApplications` with the empty constraint, GHC doesn't add parenthesis (it should look like `... -> ECC (() :: Constraint) [] ()`) {{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}} Doesn't seem to happen in other cases: {{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] () Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: Calanz (removed) * cc: alanz (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by Iceland_jack: Old description:
From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]:
{{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}}
When instantiating the `Constraint` using `-XTypeApplications` with the empty constraint, GHC doesn't add parenthesis (it should look like `... -> ECC (() :: Constraint) [] ()`)
{{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}}
Doesn't seem to happen in other cases:
{{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] ()
Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}}
New description: From Ryan's [https://ryanglscott.github.io/2018/02/11/how-to-derive- generic-for-some-gadts/ How to derive Generic for (some) GADTs using QuantifiedConstraints]: {{{#!hs data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a }}} When instantiating the `Constraint` using `-XTypeApplications` with the empty constraint, GHC doesn't add parentheses (it should look like `... -> ECC (() :: Constraint) [] ()`) {{{ $ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a Prelude> :t ECC @[] @() @() ECC @[] @() @() :: [()] -> ECC () :: Constraint [] () }}} Doesn't seem to happen in other cases: {{{ Prelude> :t ECC @[] @() @((), ()) ECC @[] @() @((), ()) :: [()] -> ECC (() :: Constraint, () :: Constraint) [] () Prelude> :t ECC @[] @() @(Eq Int) ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] () }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14808 | Differential Rev(s): Phab:D4408 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4408 * related: => #14808 Comment: Egads, there's an even more serious bug lurking here—the fact that you have to visibly apply the arguments to `ECC` in completely different orders on GHC 8.2.2/8.4.1 and HEAD! I've opened #14808 for this. In the meantime, I've opened Phab:D4408 for this bug, which is straightforward to fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint)
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords:
| TypeApplications
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #14808 | Differential Rev(s): Phab:D4408
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#14796: Pretty Printing: GHC doesn't parenthesise (() :: Constraint) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14796 Blocked By: | Blocking: Related Tickets: #14808 | Differential Rev(s): Phab:D4408 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => ghci/scripts/T14796 * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14796#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC