@@ -56,7 +56,7 @@ p_valDecl = line . p_valDecl'
5656p_valDecl' :: HsBindLR GhcPs GhcPs -> R ()
5757p_valDecl' = \case
5858 FunBind NoExt funId funMatches _ _ -> p_funBind funId funMatches
59− PatBind NoExt pat grhss _ -> p_match PatternBind False [pat] grhss
59+ PatBind NoExt pat grhss _ -> p_match PatternBind False NoSrcStrict [pat] grhss
6060 VarBind {} -> notImplemented "VarBinds" -- introduced by the type checker
6161 AbsBinds {} -> notImplemented "AbsBinds" -- introduced by the type checker
6262 PatSynBind NoExt psb -> p_patSynBind psb
@@ -85,12 +85,19 @@ p_matchGroup'
8585p_matchGroup' placer pretty style MG {..} =
8686 locatedVia Nothing mg_alts $
8787 newlineSep (located' (\m@Match {..} ->
88− p_match' placer pretty style (isInfixMatch m) m_pats m_grhss))
88+ p_match' placer pretty style (isInfixMatch m) (matchStrictness m) m_pats m_grhss))
8989p_matchGroup' _ _ _ (XMatchGroup NoExt) = notImplemented "XMatchGroup"
9090
91+matchStrictness :: Match id body -> SrcStrictness
92+matchStrictness match =
93+ case m_ctxt match of
94+ FunRhs{mc_strictness=s} -> s
95+ _ -> NoSrcStrict
96+
9197p_match
9298 :: MatchGroupStyle
9399 -> Bool -- ^ Is this an infix match?
100+ -> SrcStrictness -- ^ Strictness prefix (FunBind)
94101 -> [LPat GhcPs]
95102 -> GRHSs GhcPs (LHsExpr GhcPs)
96103 -> R ()
@@ -102,10 +109,11 @@ p_match'
102109 -> (body -> R ())
103110 -> MatchGroupStyle
104111 -> Bool -- ^ Is this an infix match?
112+ -> SrcStrictness -- ^ Strictness prefix (FunBind)
105113 -> [LPat GhcPs]
106114 -> GRHSs GhcPs (Located body)
107115 -> R ()
108−p_match' placer pretty style isInfix m_pats m_grhss = do
116+p_match' placer pretty style isInfix strictness m_pats m_grhss = do
109117 -- NOTE Normally, since patterns may be placed in a multi-line layout, it
110118 -- is necessary to bump indentation for the pattern group so it's more
111119 -- indented than function name. This in turn means that indentation for
@@ -113,6 +121,10 @@ p_match' placer pretty style isInfix m_pats m_grhss = do
113121 -- would start with two indentation steps applied, which is ugly, so we
114122 -- need to be a bit more clever here and bump indentation level only when
115123 -- pattern group is multiline.
124+ case strictness of
125+ NoSrcStrict -> return ()
126+ SrcStrict -> txt "!"
127+ SrcLazy -> txt "~"
116128 inci' <- case NE.nonEmpty m_pats of
117129 Nothing -> id <$ case style of
118130 Function name -> p_rdrName name