on master help sign in
Prevent type applications from gluing to TH splices that follow them
cc337bdMark Karpov
CHANGELOG.md+3
@@ -22,6 +22,9 @@
22* Blank lines between definitions in `let` and `while` bindings are now
22* Blank lines between definitions in `let` and `while` bindings are now
23 preserved. [Issue 554](https://github.com/tweag/ormolu/issues/554).
23 preserved. [Issue 554](https://github.com/tweag/ormolu/issues/554).
24
24
25+* Fixed the bug when type applications glued to TH splices that followed
26+ them. [Issue 613](https://github.com/tweag/ormolu/issues/613).
27+
25## Ormolu 0.1.0.0
28## Ormolu 0.1.0.0
26
29
27* Fixed rendering of type signatures concerning several identifiers. [Issue
30* Fixed rendering of type signatures concerning several identifiers. [Issue
data/examples/declaration/value/function/type-applications-and-splice-out.hsnew file+4
@@ -0,0 +1,4 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+{-# LANGUAGE TypeApplications #-}
3+
4+staticKey name = [|sing @ $(symFQN name)|]
data/examples/declaration/value/function/type-applications-and-splice.hsnew file+4
@@ -0,0 +1,4 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+{-# LANGUAGE TypeApplications #-}
3+
4+staticKey name = [| sing @ $(symFQN name) |]
src/Ormolu/Printer/Meat/Declaration/Value.hs+5
@@ -613,6 +613,11 @@ p_hsExpr' s = \case
613 breakpoint
613 breakpoint
614 inci $ do
614 inci $ do
615 txt "@"
615 txt "@"
616+ -- Insert a space when the type is represented as a TH splice to avoid
617+ -- gluing @ and $ together.
618+ case unLoc (hswc_body a) of
619+ HsSpliceTy {} -> space
620+ _ -> return ()
616 located (hswc_body a) p_hsType
621 located (hswc_body a) p_hsType
617 OpApp NoExtField x op y -> do
622 OpApp NoExtField x op y -> do
618 let opTree = OpBranch (exprOpTree x) op (exprOpTree y)
623 let opTree = OpBranch (exprOpTree x) op (exprOpTree y)