#15985 closed bug (fixed)

`pprint EqualityT` infinitely loops

Reported by: RyanGlScott Owned by:
Priority: normal Milestone: 8.8.1
Component: Template Haskell Version: 8.6.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T15985
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D5403
Wiki Page:


I was very surprised to discover that this program loops infinitely:

module Main where

import Language.Haskell.TH

main :: IO ()
main = print $ pprint EqualityT

Let's not do that. Patch incoming.

Change History (3)

comment:1 Changed 11 months ago by RyanGlScott

Differential Rev(s): Phab:D5403
Status: newpatch

comment:2 Changed 11 months ago by Ryan Scott <ryan.gl.scott@…>

In 89d8092/ghc:

Fix embarrassing infinite loop in pprParendType

`pprParendType` was missing an explicit case for
`EqualityT`, which caused it to fall through to a catch-all case
that invokes `ppr`. But `ppr` itself does not have a case for a
partial application of `EqualityT`, so //it// falls back to
`pprParendType`, resulting in an infinite loop!

The fix is simple: add a case for `EqualityT` in `pprParendType`.
While I was in the neighborhood, I removed the catch-call case in
`pprParendType` to make this sort of mistake less likely to happen
in the future.

Test Plan: make test TEST=T15985

Reviewers: bgamari, monoidal, simonpj

Reviewed By: monoidal, simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15985

Differential Revision: https://phabricator.haskell.org/D5403

comment:3 Changed 11 months ago by RyanGlScott

Resolution: fixed
Status: patchclosed
Test Case: th/T15985
Note: See TracTickets for help on using tickets.