{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DataKinds #-}
module Language.Haskell.Syntax.Pat (
Pat(..), LPat,
ConLikeP,
HsConPatDetails, hsConPatArgs,
HsRecFields(..), HsFieldBind(..), LHsFieldBind,
HsRecField, LHsRecField,
HsRecUpdField, LHsRecUpdField,
hsRecFields, hsRecFieldSel, hsRecFieldsArgs,
) where
import GHC.Prelude
import {-# SOURCE #-} Language.Haskell.Syntax.Expr (SyntaxExpr, LHsExpr, HsSplice)
import Language.Haskell.Syntax.Lit
import Language.Haskell.Syntax.Extension
import Language.Haskell.Syntax.Type
import GHC.Types.Basic
import GHC.Core.Ppr ( )
import GHC.Utils.Outputable
import GHC.Types.SrcLoc
type LPat p = XRec p (Pat p)
data Pat p
=
WildPat (XWildPat p)
| VarPat (XVarPat p)
(LIdP p)
| LazyPat (XLazyPat p)
(LPat p)
| AsPat (XAsPat p)
(LIdP p) (LPat p)
| ParPat (XParPat p)
!(LHsToken "(" p)
(LPat p)
!(LHsToken ")" p)
| BangPat (XBangPat p)
(LPat p)
| ListPat (XListPat p)
[LPat p]
| TuplePat (XTuplePat p)
[LPat p]
Boxity
| SumPat (XSumPat p)
(LPat p)
ConTag
Arity
| ConPat {
forall p. Pat p -> XConPat p
pat_con_ext :: XConPat p,
forall p. Pat p -> XRec p (ConLikeP p)
pat_con :: XRec p (ConLikeP p),
forall p. Pat p -> HsConPatDetails p
pat_args :: HsConPatDetails p
}
| ViewPat (XViewPat p)
(LHsExpr p)
(LPat p)
| SplicePat (XSplicePat p)
(HsSplice p)
| LitPat (XLitPat p)
(HsLit p)
| NPat
(XNPat p)
(XRec p (HsOverLit p))
(Maybe (SyntaxExpr p))
(SyntaxExpr p)
| NPlusKPat (XNPlusKPat p)
(LIdP p)
(XRec p (HsOverLit p))
(HsOverLit p)
(SyntaxExpr p)
(SyntaxExpr p)
| SigPat (XSigPat p)
(LPat p)
(HsPatSigType (NoGhcTc p))
| XPat
!(XXPat p)
type family ConLikeP x
type HsConPatDetails p = HsConDetails (HsPatSigType (NoGhcTc p)) (LPat p) (HsRecFields p (LPat p))
hsConPatArgs :: forall p . (UnXRec p) => HsConPatDetails p -> [LPat p]
hsConPatArgs :: forall p. UnXRec p => HsConPatDetails p -> [LPat p]
hsConPatArgs (PrefixCon [HsPatSigType (NoGhcTc p)]
_ [LPat p]
ps) = [LPat p]
ps
hsConPatArgs (RecCon HsRecFields p (LPat p)
fs) = (XRec p (HsFieldBind (XRec p (FieldOcc p)) (LPat p)) -> LPat p)
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) (LPat p))]
-> [LPat p]
forall a b. (a -> b) -> [a] -> [b]
map (HsFieldBind (XRec p (FieldOcc p)) (LPat p) -> LPat p
forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS (HsFieldBind (XRec p (FieldOcc p)) (LPat p) -> LPat p)
-> (XRec p (HsFieldBind (XRec p (FieldOcc p)) (LPat p))
-> HsFieldBind (XRec p (FieldOcc p)) (LPat p))
-> XRec p (HsFieldBind (XRec p (FieldOcc p)) (LPat p))
-> LPat p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p) (HsRecFields p (LPat p)
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) (LPat p))]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p (LPat p)
fs)
hsConPatArgs (InfixCon LPat p
p1 LPat p
p2) = [LPat p
p1,LPat p
p2]
data HsRecFields p arg
= HsRecFields { forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds :: [LHsRecField p arg],
forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot :: Maybe (Located Int) }
type LHsFieldBind p id arg = XRec p (HsFieldBind id arg)
type LHsRecField p arg = XRec p (HsRecField p arg)
type LHsRecUpdField p = XRec p (HsRecUpdField p)
type HsRecField p arg = HsFieldBind (LFieldOcc p) arg
type HsRecUpdField p = HsFieldBind (LAmbiguousFieldOcc p) (LHsExpr p)
data HsFieldBind lhs rhs = HsFieldBind {
forall lhs rhs. HsFieldBind lhs rhs -> XHsFieldBind lhs
hfbAnn :: XHsFieldBind lhs,
forall lhs rhs. HsFieldBind lhs rhs -> lhs
hfbLHS :: lhs,
forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS :: rhs,
forall lhs rhs. HsFieldBind lhs rhs -> Bool
hfbPun :: Bool
} deriving ((forall a b. (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b)
-> (forall a b. a -> HsFieldBind lhs b -> HsFieldBind lhs a)
-> Functor (HsFieldBind lhs)
forall a b. a -> HsFieldBind lhs b -> HsFieldBind lhs a
forall a b. (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b
forall lhs a b. a -> HsFieldBind lhs b -> HsFieldBind lhs a
forall lhs a b. (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall lhs a b. (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b
fmap :: forall a b. (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b
$c<$ :: forall lhs a b. a -> HsFieldBind lhs b -> HsFieldBind lhs a
<$ :: forall a b. a -> HsFieldBind lhs b -> HsFieldBind lhs a
Functor, (forall m. Monoid m => HsFieldBind lhs m -> m)
-> (forall m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m)
-> (forall m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m)
-> (forall a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b)
-> (forall a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b)
-> (forall a. (a -> a -> a) -> HsFieldBind lhs a -> a)
-> (forall a. (a -> a -> a) -> HsFieldBind lhs a -> a)
-> (forall a. HsFieldBind lhs a -> [a])
-> (forall a. HsFieldBind lhs a -> Bool)
-> (forall a. HsFieldBind lhs a -> Int)
-> (forall a. Eq a => a -> HsFieldBind lhs a -> Bool)
-> (forall a. Ord a => HsFieldBind lhs a -> a)
-> (forall a. Ord a => HsFieldBind lhs a -> a)
-> (forall a. Num a => HsFieldBind lhs a -> a)
-> (forall a. Num a => HsFieldBind lhs a -> a)
-> Foldable (HsFieldBind lhs)
forall a. Eq a => a -> HsFieldBind lhs a -> Bool
forall a. Num a => HsFieldBind lhs a -> a
forall a. Ord a => HsFieldBind lhs a -> a
forall m. Monoid m => HsFieldBind lhs m -> m
forall a. HsFieldBind lhs a -> Bool
forall a. HsFieldBind lhs a -> Int
forall a. HsFieldBind lhs a -> [a]
forall a. (a -> a -> a) -> HsFieldBind lhs a -> a
forall lhs a. Eq a => a -> HsFieldBind lhs a -> Bool
forall lhs a. Num a => HsFieldBind lhs a -> a
forall lhs a. Ord a => HsFieldBind lhs a -> a
forall m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
forall lhs m. Monoid m => HsFieldBind lhs m -> m
forall lhs rhs. HsFieldBind lhs rhs -> Bool
forall lhs a. HsFieldBind lhs a -> Int
forall lhs a. HsFieldBind lhs a -> [a]
forall b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
forall a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
forall lhs a. (a -> a -> a) -> HsFieldBind lhs a -> a
forall lhs m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
forall lhs b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
forall lhs a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall lhs m. Monoid m => HsFieldBind lhs m -> m
fold :: forall m. Monoid m => HsFieldBind lhs m -> m
$cfoldMap :: forall lhs m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
$cfoldMap' :: forall lhs m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> HsFieldBind lhs a -> m
$cfoldr :: forall lhs a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
foldr :: forall a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
$cfoldr' :: forall lhs a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> HsFieldBind lhs a -> b
$cfoldl :: forall lhs b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
foldl :: forall b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
$cfoldl' :: forall lhs b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> HsFieldBind lhs a -> b
$cfoldr1 :: forall lhs a. (a -> a -> a) -> HsFieldBind lhs a -> a
foldr1 :: forall a. (a -> a -> a) -> HsFieldBind lhs a -> a
$cfoldl1 :: forall lhs a. (a -> a -> a) -> HsFieldBind lhs a -> a
foldl1 :: forall a. (a -> a -> a) -> HsFieldBind lhs a -> a
$ctoList :: forall lhs a. HsFieldBind lhs a -> [a]
toList :: forall a. HsFieldBind lhs a -> [a]
$cnull :: forall lhs rhs. HsFieldBind lhs rhs -> Bool
null :: forall a. HsFieldBind lhs a -> Bool
$clength :: forall lhs a. HsFieldBind lhs a -> Int
length :: forall a. HsFieldBind lhs a -> Int
$celem :: forall lhs a. Eq a => a -> HsFieldBind lhs a -> Bool
elem :: forall a. Eq a => a -> HsFieldBind lhs a -> Bool
$cmaximum :: forall lhs a. Ord a => HsFieldBind lhs a -> a
maximum :: forall a. Ord a => HsFieldBind lhs a -> a
$cminimum :: forall lhs a. Ord a => HsFieldBind lhs a -> a
minimum :: forall a. Ord a => HsFieldBind lhs a -> a
$csum :: forall lhs a. Num a => HsFieldBind lhs a -> a
sum :: forall a. Num a => HsFieldBind lhs a -> a
$cproduct :: forall lhs a. Num a => HsFieldBind lhs a -> a
product :: forall a. Num a => HsFieldBind lhs a -> a
Foldable, Functor (HsFieldBind lhs)
Foldable (HsFieldBind lhs)
Functor (HsFieldBind lhs)
-> Foldable (HsFieldBind lhs)
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b))
-> (forall (f :: * -> *) a.
Applicative f =>
HsFieldBind lhs (f a) -> f (HsFieldBind lhs a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b))
-> (forall (m :: * -> *) a.
Monad m =>
HsFieldBind lhs (m a) -> m (HsFieldBind lhs a))
-> Traversable (HsFieldBind lhs)
forall lhs. Functor (HsFieldBind lhs)
forall lhs. Foldable (HsFieldBind lhs)
forall lhs (m :: * -> *) a.
Monad m =>
HsFieldBind lhs (m a) -> m (HsFieldBind lhs a)
forall lhs (f :: * -> *) a.
Applicative f =>
HsFieldBind lhs (f a) -> f (HsFieldBind lhs a)
forall lhs (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b)
forall lhs (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
HsFieldBind lhs (m a) -> m (HsFieldBind lhs a)
forall (f :: * -> *) a.
Applicative f =>
HsFieldBind lhs (f a) -> f (HsFieldBind lhs a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b)
$ctraverse :: forall lhs (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b)
$csequenceA :: forall lhs (f :: * -> *) a.
Applicative f =>
HsFieldBind lhs (f a) -> f (HsFieldBind lhs a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
HsFieldBind lhs (f a) -> f (HsFieldBind lhs a)
$cmapM :: forall lhs (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b)
$csequence :: forall lhs (m :: * -> *) a.
Monad m =>
HsFieldBind lhs (m a) -> m (HsFieldBind lhs a)
sequence :: forall (m :: * -> *) a.
Monad m =>
HsFieldBind lhs (m a) -> m (HsFieldBind lhs a)
Traversable)
hsRecFields :: forall p arg.UnXRec p => HsRecFields p arg -> [XCFieldOcc p]
hsRecFields :: forall p arg. UnXRec p => HsRecFields p arg -> [XCFieldOcc p]
hsRecFields HsRecFields p arg
rbinds = (XRec p (HsFieldBind (XRec p (FieldOcc p)) arg) -> XCFieldOcc p)
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)]
-> [XCFieldOcc p]
forall a b. (a -> b) -> [a] -> [b]
map (HsFieldBind (XRec p (FieldOcc p)) arg -> XCFieldOcc p
forall p arg. UnXRec p => HsRecField p arg -> XCFieldOcc p
hsRecFieldSel (HsFieldBind (XRec p (FieldOcc p)) arg -> XCFieldOcc p)
-> (XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)
-> HsFieldBind (XRec p (FieldOcc p)) arg)
-> XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)
-> XCFieldOcc p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p) (HsRecFields p arg
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p arg
rbinds)
hsRecFieldsArgs :: forall p arg. UnXRec p => HsRecFields p arg -> [arg]
hsRecFieldsArgs :: forall p arg. UnXRec p => HsRecFields p arg -> [arg]
hsRecFieldsArgs HsRecFields p arg
rbinds = (XRec p (HsFieldBind (XRec p (FieldOcc p)) arg) -> arg)
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)] -> [arg]
forall a b. (a -> b) -> [a] -> [b]
map (HsFieldBind (XRec p (FieldOcc p)) arg -> arg
forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS (HsFieldBind (XRec p (FieldOcc p)) arg -> arg)
-> (XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)
-> HsFieldBind (XRec p (FieldOcc p)) arg)
-> XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)
-> arg
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p) (HsRecFields p arg
-> [XRec p (HsFieldBind (XRec p (FieldOcc p)) arg)]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p arg
rbinds)
hsRecFieldSel :: forall p arg. UnXRec p => HsRecField p arg -> XCFieldOcc p
hsRecFieldSel :: forall p arg. UnXRec p => HsRecField p arg -> XCFieldOcc p
hsRecFieldSel = FieldOcc p -> XCFieldOcc p
forall pass. FieldOcc pass -> XCFieldOcc pass
foExt (FieldOcc p -> XCFieldOcc p)
-> (HsFieldBind (XRec p (FieldOcc p)) arg -> FieldOcc p)
-> HsFieldBind (XRec p (FieldOcc p)) arg
-> XCFieldOcc p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p (XRec p (FieldOcc p) -> FieldOcc p)
-> (HsFieldBind (XRec p (FieldOcc p)) arg -> XRec p (FieldOcc p))
-> HsFieldBind (XRec p (FieldOcc p)) arg
-> FieldOcc p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsFieldBind (XRec p (FieldOcc p)) arg -> XRec p (FieldOcc p)
forall lhs rhs. HsFieldBind lhs rhs -> lhs
hfbLHS
instance (Outputable arg, Outputable (XRec p (HsRecField p arg)))
=> Outputable (HsRecFields p arg) where
ppr :: HsRecFields p arg -> SDoc
ppr (HsRecFields { rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds = [XRec p (HsRecField p arg)]
flds, rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot = Maybe (Located Int)
Nothing })
= SDoc -> SDoc
braces ([SDoc] -> SDoc
fsep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((XRec p (HsRecField p arg) -> SDoc)
-> [XRec p (HsRecField p arg)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map XRec p (HsRecField p arg) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [XRec p (HsRecField p arg)]
flds)))
ppr (HsRecFields { rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds = [XRec p (HsRecField p arg)]
flds, rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot = Just (Located Int -> Int
forall l e. GenLocated l e -> e
unLoc -> Int
n) })
= SDoc -> SDoc
braces ([SDoc] -> SDoc
fsep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((XRec p (HsRecField p arg) -> SDoc)
-> [XRec p (HsRecField p arg)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map XRec p (HsRecField p arg) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Int -> [XRec p (HsRecField p arg)] -> [XRec p (HsRecField p arg)]
forall a. Int -> [a] -> [a]
take Int
n [XRec p (HsRecField p arg)]
flds) [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [SDoc
dotdot])))
where
dotdot :: SDoc
dotdot = String -> SDoc
text String
".." SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
whenPprDebug ([XRec p (HsRecField p arg)] -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Int -> [XRec p (HsRecField p arg)] -> [XRec p (HsRecField p arg)]
forall a. Int -> [a] -> [a]
drop Int
n [XRec p (HsRecField p arg)]
flds))
instance (Outputable p, OutputableBndr p, Outputable arg)
=> Outputable (HsFieldBind p arg) where
ppr :: HsFieldBind p arg -> SDoc
ppr (HsFieldBind { hfbLHS :: forall lhs rhs. HsFieldBind lhs rhs -> lhs
hfbLHS = p
f, hfbRHS :: forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS = arg
arg,
hfbPun :: forall lhs rhs. HsFieldBind lhs rhs -> Bool
hfbPun = Bool
pun })
= p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc p
f SDoc -> SDoc -> SDoc
<+> (Bool -> SDoc -> SDoc
ppUnless Bool
pun (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc
equals SDoc -> SDoc -> SDoc
<+> arg -> SDoc
forall a. Outputable a => a -> SDoc
ppr arg
arg)