Argument-less infix declarations printed without parentheses in -ddump-splices
Compile this:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
$([d| type (|||) = Either
(&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
data (***)
|])
And you'll get this:
$ /opt/ghc/8.4.3/bin/ghci Bug.hs
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:(6,3)-(12,6): Splicing declarations
[d| (&&&_a1xt) :: Bool -> Bool -> Bool
(&&&_a1xt) = (&&)
type |||_a1xs = Either
data ***_a1xr |]
======>
type |||_a5bW = Either
(&&&_a5bV) :: Bool -> Bool -> Bool
(&&&_a5bV) = (&&)
data ***_a5bX
Ok, one module loaded.
Notice the pretty-printed declarations of type |||_a5bW
and data ***_a5bX
, which are lacking some necessary parentheses.
Trac metadata
Trac field | Value |
---|---|
Version | 8.4.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |