on master help sign in
Some cosmetic changes in ‘Value.hs’
commit374aca58e42c57002bf220d091d19426c9395710 authormrkkrp <mark.karpov@tweag.io> dateTue 27 Aug 2019, 18:38 (7 years ago) parent075b2b3
1 file changed+18−14
src/Ormolu/Printer/Meat/Declaration/Value.hs+18−14
src/Ormolu/Printer/Meat/Declaration/Value.hs+18−14
@@ -31,6 +31,8 @@ import SrcLoc (combineSrcSpans, isOneLineSpan)
3131import qualified Data.List.NonEmpty as NE
3232import {-# SOURCE #-} Ormolu.Printer.Meat.Declaration
3333
34+-- | Style of a group of equations.
35+
3436data MatchGroupStyle
3537 = Function (Located RdrName)
3638 | PatternBind
@@ -38,6 +40,8 @@ data MatchGroupStyle
3840 | Lambda
3941 | LambdaCase
4042
43+-- | Style of equations in a group.
44+
4145data GroupStyle
4246 = EqualSign
4347 | RightArrow
@@ -76,10 +80,10 @@ p_matchGroup = p_matchGroup' exprPlacement p_hsExpr
7680
7781p_matchGroup'
7882 :: Data body
79− => (body -> Placement)
80− -> (body -> R ())
81− -> MatchGroupStyle
82− -> MatchGroup GhcPs (Located body)
83+ => (body -> Placement) -- ^ How to get body placement
84+ -> (body -> R ()) -- ^ How to print body
85+ -> MatchGroupStyle -- ^ Style of this group of equations
86+ -> MatchGroup GhcPs (Located body) -- ^ Match group
8387 -> R ()
8488p_matchGroup' placer pretty style MG {..} = do
8589 let ob = case style of
@@ -125,23 +129,23 @@ matchStrictness match =
125129 _ -> NoSrcStrict
126130
127131p_match
128− :: MatchGroupStyle
132+ :: MatchGroupStyle -- ^ Style of the group
129133 -> Bool -- ^ Is this an infix match?
130134 -> SrcStrictness -- ^ Strictness prefix (FunBind)
131− -> [LPat GhcPs]
132− -> GRHSs GhcPs (LHsExpr GhcPs)
135+ -> [LPat GhcPs] -- ^ Argument patterns
136+ -> GRHSs GhcPs (LHsExpr GhcPs) -- ^ Equations
133137 -> R ()
134138p_match = p_match' exprPlacement p_hsExpr
135139
136140p_match'
137141 :: Data body
138− => (body -> Placement)
139− -> (body -> R ())
140− -> MatchGroupStyle
142+ => (body -> Placement) -- ^ How to get body placement
143+ -> (body -> R ()) -- ^ How to print body
144+ -> MatchGroupStyle -- ^ Style of this group of equations
141145 -> Bool -- ^ Is this an infix match?
142146 -> SrcStrictness -- ^ Strictness prefix (FunBind)
143− -> [LPat GhcPs]
144− -> GRHSs GhcPs (Located body)
147+ -> [LPat GhcPs] -- ^ Argument patterns
148+ -> GRHSs GhcPs (Located body) -- ^ Equations
145149 -> R ()
146150p_match' placer pretty style isInfix strictness m_pats m_grhss = do
147151 -- NOTE Normally, since patterns may be placed in a multi-line layout, it
@@ -879,7 +883,7 @@ p_hsSpliceTH isTyped expr = \case
879883 HasDollar -> do
880884 txt decoSymbol
881885 located expr (sitcc . p_hsExpr)
882− NoParens -> do
886+ NoParens ->
883887 located expr (sitcc . p_hsExpr)
884888 where
885889 decoSymbol = if isTyped then "$$" else "$"
@@ -951,7 +955,7 @@ getGRHSSpan (XGRHS NoExt) = notImplemented "XGRHS"
951955-- depending on what sort of expression we have.
952956
953957placeHanging :: Placement -> R () -> R ()
954−placeHanging placement m = do
958+placeHanging placement m =
955959 case placement of
956960 Hanging -> do
957961 space