@@ -4,6 +4,7 @@
5module Ormolu.Printer.Meat.Declaration.Value
5module Ormolu.Printer.Meat.Declaration.Value
6 ( p_valDecl
6 ( p_valDecl
@@ -15,7 +16,6 @@ import Data.List (sortOn)
16import Ormolu.Printer.Combinators
17import Ormolu.Printer.Combinators
17import Ormolu.Printer.Meat.Common
18import Ormolu.Printer.Meat.Common
18−import Ormolu.Printer.Meat.Declaration.Pat
19import Ormolu.Printer.Meat.Declaration.Signature
19import Ormolu.Printer.Meat.Declaration.Signature
20import Ormolu.Printer.Meat.Type
20import Ormolu.Printer.Meat.Type
21import Ormolu.Utils
21import Ormolu.Utils
@@ -428,6 +428,78 @@ p_patSynDetails = \case
428 velt' (p_rdrName . recordPatSynPatVar <$> xs)
428 velt' (p_rdrName . recordPatSynPatVar <$> xs)
429 InfixCon _ _ -> notImplemented "InfixCon"
429 InfixCon _ _ -> notImplemented "InfixCon"
431+p_pat :: Pat GhcPs -> R ()
433+ WildPat NoExt -> txt "_"
434+ VarPat NoExt name -> p_rdrName name
435+ LazyPat NoExt pat -> do
438+ AsPat NoExt name pat -> do
443+ located pat (parens . p_pat)
444+ BangPat NoExt pat -> do
447+ ListPat NoExt pats -> do
448+ brackets $ velt (withSep comma (located' p_pat) pats)
449+ TuplePat NoExt pats boxing -> do
453+ Unboxed -> parensHash
454+ f $ velt (withSep comma (located' p_pat) pats)
455+ SumPat NoExt pat _ _ -> do
456+ -- XXX I'm not sure about this one.
458+ ConPatIn pat details ->
460+ PrefixCon xs -> sitcc $ do
462+ unless (null xs) $ do
464+ inci $ velt' (located' p_pat <$> xs)
465+ RecCon (HsRecFields fields dotdot) -> do
470+ Just x -> located x p_pat_hsRecField
471+ inci . braces . velt . withSep comma f $ case dotdot of
472+ Nothing -> Just <$> fields
473+ Just n -> (Just <$> take n fields) ++ [Nothing]
479+ inci (located y p_pat)
480+ ConPatOut {} -> notImplemented "ConPatOut"
481+ ViewPat NoExt expr pat -> sitcc $ do
482+ located expr p_hsExpr
485+ inci (located pat p_pat)
486+ SplicePat {} -> notImplemented "SplicePat"
487+ LitPat NoExt p -> atom p
488+ NPat NoExt v _ _ -> located v (atom . ol_val)
489+ NPlusKPat {} -> notImplemented "NPlusKPat"
490+ SigPat {} -> notImplemented "SigPat"
491+ CoPat {} -> notImplemented "CoPat"
492+ XPat NoExt -> notImplemented "XPat"
494+p_pat_hsRecField :: HsRecField' (FieldOcc GhcPs) (LPat GhcPs) -> R ()
495+p_pat_hsRecField HsRecField {..} = do
496+ located hsRecFieldLbl $ \x ->
497+ p_rdrName (rdrNameFieldOcc x)
498+ unless hsRecPun $ do
501+ inci (located hsRecFieldArg p_pat)
431----------------------------------------------------------------------------
503----------------------------------------------------------------------------
432-- Helpers
504-- Helpers