-ddump-splices omits required parentheses around quantified constraints
If you compile this program with `-ddump-splices`: ```hs {-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Language.Haskell.TH data Foo x = MkFoo x $([d| f :: (forall a. Eq (Foo a)) => Foo x -> Foo x -> Bool f = (==) |]) ``` You'll notice something fishy: ``` $ /opt/ghc/8.6.1/bin/ghci Bug.hs GHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:(10,3)-(12,6): Splicing declarations [d| f_a1Ia :: (forall a_a1Ic. Eq (Foo a_a1Ic)) => Foo x_a1Ib -> Foo x_a1Ib -> Bool f_a1Ia = (==) |] ======> f_a5tj :: forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool f_a5tj = (==) Ok, one module loaded. ``` The signature for `f` gets pretty-printed as: ```hs f_a5tj :: forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool ``` Which is just plain wrong—there is a missing set of parentheses around the quantified constraint `forall a_a5tk. Eq (Foo a_a5tk)`. Patch incoming. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ---------------- | | Version | 8.6.1 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Template Haskell | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"-ddump-splices omits required parentheses around quantified constraints","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If you compile this program with `-ddump-splices`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE QuantifiedConstraints #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# OPTIONS_GHC -ddump-splices #-}\r\nmodule Bug where\r\n\r\nimport Language.Haskell.TH\r\n\r\ndata Foo x = MkFoo x\r\n\r\n$([d| f :: (forall a. Eq (Foo a)) => Foo x -> Foo x -> Bool\r\n f = (==)\r\n |])\r\n}}}\r\n\r\nYou'll notice something fishy:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghci Bug.hs\r\nGHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\nBug.hs:(10,3)-(12,6): Splicing declarations\r\n [d| f_a1Ia ::\r\n (forall a_a1Ic. Eq (Foo a_a1Ic)) =>\r\n Foo x_a1Ib -> Foo x_a1Ib -> Bool\r\n f_a1Ia = (==) |]\r\n ======>\r\n f_a5tj ::\r\n forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool\r\n f_a5tj = (==)\r\nOk, one module loaded.\r\n}}}\r\n\r\nThe signature for `f` gets pretty-printed as:\r\n\r\n{{{#!hs\r\nf_a5tj :: forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool\r\n}}}\r\n\r\nWhich is just plain wrong—there is a missing set of parentheses around the quantified constraint `forall a_a5tk. Eq (Foo a_a5tk)`.\r\n\r\nPatch incoming.","type_of_failure":"OtherFailure","blocking":[]} -->
issue