haskell-language-server-2.9.0.0: LSP server for GHC
Safe HaskellSafe-Inferred
LanguageGHC2021

Development.IDE.GHC.ExactPrint

Description

This module hosts various abstractions and utility functions to work with ghc-exactprint.

Synopsis

Documentation

newtype Graft m a Source #

A transformation for grafting source trees together. Use the semigroup instance to combine Grafts, and run them via transform.

Constructors

Graft 

Fields

Instances

Instances details
Monad m => Monoid (Graft m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

mempty :: Graft m a #

mappend :: Graft m a -> Graft m a -> Graft m a #

mconcat :: [Graft m a] -> Graft m a #

Monad m => Semigroup (Graft m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

(<>) :: Graft m a -> Graft m a -> Graft m a #

sconcat :: NonEmpty (Graft m a) -> Graft m a #

stimes :: Integral b => b -> Graft m a -> Graft m a #

annotate :: ASTElement l ast => DynFlags -> Bool -> LocatedAn l ast -> TransformT (Either String) (LocatedAn l ast) Source #

Given an LHSExpr, compute its exactprint annotations. Note that this function will throw away any existing annotations (and format)

annotateDecl :: DynFlags -> LHsDecl GhcPs -> TransformT (Either String) (LHsDecl GhcPs) Source #

Given an LHsDecl, compute its exactprint annotations.

hoistGraft :: (forall x. m x -> n x) -> Graft m a -> Graft n a Source #

graftWithM :: forall ast m a l. (MonadFail m, Data a, ASTElement l ast) => SrcSpan -> (LocatedAn l ast -> TransformT m (Maybe (LocatedAn l ast))) -> Graft m a Source #

graftExprWithM :: forall m a. (MonadFail m, Data a) => SrcSpan -> (LHsExpr GhcPs -> TransformT m (Maybe (LHsExpr GhcPs))) -> Graft m a Source #

genericGraftWithSmallestM Source #

Arguments

:: forall m a ast. (Monad m, Data a, Typeable ast) 
=> Proxy (Located ast)

The type of nodes we'd like to consider when finding the smallest.

-> SrcSpan 
-> (DynFlags -> ast -> GenericM (TransformT m)) 
-> Graft m a 

Run the given transformation only on the smallest node in the tree that contains the SrcSpan.

genericGraftWithLargestM Source #

Arguments

:: forall m a ast. (Monad m, Data a, Typeable ast) 
=> Proxy (Located ast)

The type of nodes we'd like to consider when finding the largest.

-> SrcSpan 
-> (DynFlags -> ast -> GenericM (TransformT m)) 
-> Graft m a 

Run the given transformation only on the largest node in the tree that contains the SrcSpan.

transform :: DynFlags -> ClientCapabilities -> VersionedTextDocumentIdentifier -> Graft (Either String) ParsedSource -> ParsedSource -> Either String WorkspaceEdit Source #

Convert a Graft into a WorkspaceEdit.

transformM :: Monad m => DynFlags -> ClientCapabilities -> VersionedTextDocumentIdentifier -> Graft (ExceptStringT m) ParsedSource -> ParsedSource -> m (Either String WorkspaceEdit) Source #

Convert a Graft into a WorkspaceEdit.

class Typeable a => ExactPrint a where #

An AST fragment with an annotation must be able to return the requirements for nesting another one, captured in an Entry, and to be able to use the rest of the exactprint machinery to print the element. In the analogy to Outputable, exact plays the role of ppr.

Methods

getAnnotationEntry :: a -> Entry #

setAnnotationAnchor :: a -> Anchor -> EpAnnComments -> a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => a -> EP w m a #

Instances

Instances details
ExactPrint Void 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Void -> Entry #

setAnnotationAnchor :: Void -> Anchor -> EpAnnComments -> Void #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Void -> EP w m Void #

ExactPrint FastString 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint HsDocString 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint HsDocStringChunk 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint CCallConv 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: CCallConv -> Entry #

setAnnotationAnchor :: CCallConv -> Anchor -> EpAnnComments -> CCallConv #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => CCallConv -> EP w m CCallConv #

ExactPrint CExportSpec 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint Safety 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Safety -> Entry #

setAnnotationAnchor :: Safety -> Anchor -> EpAnnComments -> Safety #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Safety -> EP w m Safety #

ExactPrint StringLiteral 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint Role 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Role -> Entry #

setAnnotationAnchor :: Role -> Anchor -> EpAnnComments -> Role #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Role -> EP w m Role #

ExactPrint ModuleName 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint HsIPName 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsIPName -> Entry #

setAnnotationAnchor :: HsIPName -> Anchor -> EpAnnComments -> HsIPName #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsIPName -> EP w m HsIPName #

ExactPrint DataFamInstDeclWithContext 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: DataFamInstDeclWithContext -> Entry #

setAnnotationAnchor :: DataFamInstDeclWithContext -> Anchor -> EpAnnComments -> DataFamInstDeclWithContext #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => DataFamInstDeclWithContext -> EP w m DataFamInstDeclWithContext #

ExactPrint (BooleanFormula (LocatedN RdrName)) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint a => ExactPrint (LocatedA a) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: LocatedA a -> Entry #

setAnnotationAnchor :: LocatedA a -> Anchor -> EpAnnComments -> LocatedA a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => LocatedA a -> EP w m (LocatedA a) #

ExactPrint a => ExactPrint (LocatedC a) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: LocatedC a -> Entry #

setAnnotationAnchor :: LocatedC a -> Anchor -> EpAnnComments -> LocatedC a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => LocatedC a -> EP w m (LocatedC a) #

ExactPrint (LocatedL (BooleanFormula (LocatedN RdrName))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (Match GhcPs (LocatedA body)) => ExactPrint (LocatedL [LocatedA (Match GhcPs (LocatedA body))]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedL [LocatedA (StmtLR GhcPs GhcPs (LocatedA (HsCmd GhcPs)))]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedL [LocatedA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedL [LocatedA (IE GhcPs)]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedL [LocatedA (ConDeclField GhcPs)]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedN RdrName) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedP OverlapMode) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedP CType) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedP (WarningTxt GhcPs)) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint a => ExactPrint (Located a)

Bare Located elements are simply stripped off without further processing.

Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Located a -> Entry #

setAnnotationAnchor :: Located a -> Anchor -> EpAnnComments -> Located a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Located a -> EP w m (Located a) #

ExactPrint (HsModule GhcPs)

'Located (HsModule GhcPs)' corresponds to ParsedSource

Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsBind GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsBind GhcPs -> Entry #

setAnnotationAnchor :: HsBind GhcPs -> Anchor -> EpAnnComments -> HsBind GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsBind GhcPs -> EP w m (HsBind GhcPs) #

ExactPrint (HsIPBinds GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsLocalBinds GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (IPBind GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: IPBind GhcPs -> Entry #

setAnnotationAnchor :: IPBind GhcPs -> Anchor -> EpAnnComments -> IPBind GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => IPBind GhcPs -> EP w m (IPBind GhcPs) #

ExactPrint (RecordPatSynField GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (Sig GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Sig GhcPs -> Entry #

setAnnotationAnchor :: Sig GhcPs -> Anchor -> EpAnnComments -> Sig GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Sig GhcPs -> EP w m (Sig GhcPs) #

ExactPrint (AnnDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ClsInstDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ConDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DefaultDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DerivClauseTys GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DerivDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DerivStrategy GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DocDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (FamilyDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ForeignDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ForeignExport GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ForeignImport GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (FunDep GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: FunDep GhcPs -> Entry #

setAnnotationAnchor :: FunDep GhcPs -> Anchor -> EpAnnComments -> FunDep GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => FunDep GhcPs -> EP w m (FunDep GhcPs) #

ExactPrint (HsDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsDecl GhcPs -> Entry #

setAnnotationAnchor :: HsDecl GhcPs -> Anchor -> EpAnnComments -> HsDecl GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsDecl GhcPs -> EP w m (HsDecl GhcPs) #

ExactPrint (HsDerivingClause GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (InjectivityAnn GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (InstDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (RoleAnnotDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (RuleBndr GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (RuleDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (RuleDecls GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (SpliceDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (StandaloneKindSig GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (TyClDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (TyFamInstDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (WarnDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (WarnDecls GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (DotFieldOcc GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (FieldLabelStrings GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsCmd GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsCmd GhcPs -> Entry #

setAnnotationAnchor :: HsCmd GhcPs -> Anchor -> EpAnnComments -> HsCmd GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsCmd GhcPs -> EP w m (HsCmd GhcPs) #

ExactPrint (HsCmdTop GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsExpr GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsExpr GhcPs -> Entry #

setAnnotationAnchor :: HsExpr GhcPs -> Anchor -> EpAnnComments -> HsExpr GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsExpr GhcPs -> EP w m (HsExpr GhcPs) #

ExactPrint (HsPragE GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsTupArg GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsUntypedSplice GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (IE GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: IE GhcPs -> Entry #

setAnnotationAnchor :: IE GhcPs -> Anchor -> EpAnnComments -> IE GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => IE GhcPs -> EP w m (IE GhcPs) #

ExactPrint (IEWrappedName GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ImportDecl GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsOverLit GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsConPatTyArg GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (Pat GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Pat GhcPs -> Entry #

setAnnotationAnchor :: Pat GhcPs -> Anchor -> EpAnnComments -> Pat GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Pat GhcPs -> EP w m (Pat GhcPs) #

ExactPrint (AmbiguousFieldOcc GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ConDeclField GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (FieldOcc GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsForAllTelescope GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsPatSigType GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsSigType GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsType GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsType GhcPs -> Entry #

setAnnotationAnchor :: HsType GhcPs -> Anchor -> EpAnnComments -> HsType GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsType GhcPs -> EP w m (HsType GhcPs) #

ExactPrint a => ExactPrint (Maybe a) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: Maybe a -> Entry #

setAnnotationAnchor :: Maybe a -> Anchor -> EpAnnComments -> Maybe a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => Maybe a -> EP w m (Maybe a) #

ExactPrint a => ExactPrint [a] 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: [a] -> Entry #

setAnnotationAnchor :: [a] -> Anchor -> EpAnnComments -> [a] #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => [a] -> EP w m [a] #

(ExactPrint (HsFieldBind (LocatedAn NoEpAnns (a GhcPs)) body), ExactPrint (HsFieldBind (LocatedAn NoEpAnns (b GhcPs)) body)) => ExactPrint (Either [LocatedA (HsFieldBind (LocatedAn NoEpAnns (a GhcPs)) body)] [LocatedA (HsFieldBind (LocatedAn NoEpAnns (b GhcPs)) body)]) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint a => ExactPrint (WithHsDocIdentifiers a GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint a => ExactPrint (LocatedAn NoEpAnns a) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (HsValBindsLR GhcPs GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (PatSynBind GhcPs GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint body => ExactPrint (FamEqn GhcPs body) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: FamEqn GhcPs body -> Entry #

setAnnotationAnchor :: FamEqn GhcPs body -> Anchor -> EpAnnComments -> FamEqn GhcPs body #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => FamEqn GhcPs body -> EP w m (FamEqn GhcPs body) #

ExactPrint (GRHS GhcPs (LocatedA (HsCmd GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (GRHS GhcPs (LocatedA (HsExpr GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (GRHSs GhcPs (LocatedA (HsCmd GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (GRHSs GhcPs (LocatedA (HsExpr GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (Match GhcPs (LocatedA (HsCmd GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (Match GhcPs (LocatedA (HsExpr GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (MatchGroup GhcPs (LocatedA (HsCmd GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (MatchGroup GhcPs (LocatedA (HsExpr GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (ParStmtBlock GhcPs GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint body => ExactPrint (HsFieldBind (LocatedAn NoEpAnns (FieldLabelStrings GhcPs)) body) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (LocatedA body) => ExactPrint (HsFieldBind (LocatedAn NoEpAnns (AmbiguousFieldOcc GhcPs)) (LocatedA body)) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint body => ExactPrint (HsFieldBind (LocatedAn NoEpAnns (FieldOcc GhcPs)) body) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint body => ExactPrint (HsRecFields GhcPs body) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsRecFields GhcPs body -> Entry #

setAnnotationAnchor :: HsRecFields GhcPs body -> Anchor -> EpAnnComments -> HsRecFields GhcPs body #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsRecFields GhcPs body -> EP w m (HsRecFields GhcPs body) #

(ExactPrint tm, ExactPrint ty, Outputable tm, Outputable ty) => ExactPrint (HsArg tm ty) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsArg tm ty -> Entry #

setAnnotationAnchor :: HsArg tm ty -> Anchor -> EpAnnComments -> HsArg tm ty #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsArg tm ty -> EP w m (HsArg tm ty) #

ExactPrintTVFlag flag => ExactPrint (HsOuterTyVarBndrs flag GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint a => ExactPrint (HsScaled GhcPs a) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsScaled GhcPs a -> Entry #

setAnnotationAnchor :: HsScaled GhcPs a -> Anchor -> EpAnnComments -> HsScaled GhcPs a #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsScaled GhcPs a -> EP w m (HsScaled GhcPs a) #

ExactPrintTVFlag flag => ExactPrint (HsTyVarBndr flag GhcPs) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: HsTyVarBndr flag GhcPs -> Entry #

setAnnotationAnchor :: HsTyVarBndr flag GhcPs -> Anchor -> EpAnnComments -> HsTyVarBndr flag GhcPs #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => HsTyVarBndr flag GhcPs -> EP w m (HsTyVarBndr flag GhcPs) #

ExactPrint body => ExactPrint (HsWildCardBndrs GhcPs body) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

ExactPrint (SourceText, RuleName) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

(ExactPrint (LocatedA (body GhcPs)), Anno (StmtLR GhcPs GhcPs (LocatedA (body GhcPs))) ~ SrcSpanAnnA, Anno [GenLocated SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (body GhcPs)))] ~ SrcSpanAnnL, ExactPrint (LocatedL [LocatedA (StmtLR GhcPs GhcPs (LocatedA (body GhcPs)))])) => ExactPrint (StmtLR GhcPs GhcPs (LocatedA (body GhcPs))) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.ExactPrint

Methods

getAnnotationEntry :: StmtLR GhcPs GhcPs (LocatedA (body GhcPs)) -> Entry #

setAnnotationAnchor :: StmtLR GhcPs GhcPs (LocatedA (body GhcPs)) -> Anchor -> EpAnnComments -> StmtLR GhcPs GhcPs (LocatedA (body GhcPs)) #

exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => StmtLR GhcPs GhcPs (LocatedA (body GhcPs)) -> EP w m (StmtLR GhcPs GhcPs (LocatedA (body GhcPs))) #

modifySmallestDeclWithM :: forall a m r. (HasDecls a, Monad m) => (SrcSpan -> m Bool) -> (LHsDecl GhcPs -> TransformT m ([LHsDecl GhcPs], r)) -> a -> TransformT m (a, Maybe r) Source #

Replace the smallest declaration whose SrcSpan satisfies the given condition with a new list of declarations.

For example, if you would like to move a where-clause-defined variable to the same level as its parent HsDecl, you could use this function.

When matching declaration is found in the sub-declarations of a, `Just r` is also returned with the new a. If no declaration matched, then Nothing is returned.

modifyMgMatchesT' :: Monad m => MatchGroup GhcPs (LHsExpr GhcPs) -> (LMatch GhcPs (LHsExpr GhcPs) -> TransformT m (LMatch GhcPs (LHsExpr GhcPs), r)) -> r -> (r -> r -> m r) -> TransformT m (MatchGroup GhcPs (LHsExpr GhcPs), r) Source #

Modify the each LMatch in a MatchGroup

modifySigWithM :: forall a m. (HasDecls a, Monad m, ExactPrint a) => IdP GhcPs -> (LHsSigType GhcPs -> LHsSigType GhcPs) -> a -> TransformT m a Source #

Modify the type signature for the given IdP. This function handles splitting a multi-sig SigD into multiple SigD if the type signature is changed.

For example, update the type signature for foo from Int to Bool:

  • foo :: Int + foo :: Bool
  • foo, bar :: Int + bar :: Int + foo :: Bool
  • foo, bar, baz :: Int + bar, baz :: Int + foo :: Bool

modifyAnns :: LocatedAn a ast -> (a -> a) -> LocatedAn a ast Source #

Helper function

eqSrcSpan :: SrcSpan -> SrcSpan -> Bool Source #

Equality on SrcSpan's. Ignores the (Maybe BufSpan) field of SrcSpan's.

epAnn :: SrcSpan -> ann -> EpAnn ann Source #

getAnnotatedParsedSourceRule :: Recorder (WithPriority Log) -> Rules () Source #

Get the latest version of the annotated parse source with comments.

data GetAnnotatedParsedSource Source #

Instances

Instances details
Generic GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Associated Types

type Rep GetAnnotatedParsedSource :: Type -> Type #

Show GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

NFData GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Eq GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Hashable GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

type Rep GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

type Rep GetAnnotatedParsedSource = D1 ('MetaData "GetAnnotatedParsedSource" "Development.IDE.GHC.ExactPrint" "haskell-language-server-2.9.0.0-4S5Vh3BPyyeJWzPv4aazqb-hls-refactor-plugin" 'False) (C1 ('MetaCons "GetAnnotatedParsedSource" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GetAnnotatedParsedSource Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

class (Data ast, Typeable l, Outputable l, Outputable ast, Default l) => ASTElement l ast | ast -> l where Source #

Minimal complete definition

parseAST, maybeParensAST

Methods

parseAST :: Parser (LocatedAn l ast) Source #

maybeParensAST :: LocatedAn l ast -> LocatedAn l ast Source #

graft :: forall a. Data a => SrcSpan -> LocatedAn l ast -> Graft (Either String) a Source #

Construct a Graft, replacing the node at the given SrcSpan with the given Located ast. The node at that position must already be a Located ast, or this is a no-op.

Instances

Instances details
ASTElement NameAnn RdrName Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

p ~ GhcPs => ASTElement AnnListItem (HsDecl p) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

p ~ GhcPs => ASTElement AnnListItem (HsExpr p) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

p ~ GhcPs => ASTElement AnnListItem (ImportDecl p) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

p ~ GhcPs => ASTElement AnnListItem (Pat p) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

p ~ GhcPs => ASTElement AnnListItem (HsType p) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

newtype ExceptStringT m a Source #

Constructors

ExceptStringT 

Instances

Instances details
MonadTrans ExceptStringT Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

lift :: Monad m => m a -> ExceptStringT m a #

Monad m => MonadFail (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

fail :: String -> ExceptStringT m a #

MonadIO m => MonadIO (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

liftIO :: IO a -> ExceptStringT m a #

MonadZip m => MonadZip (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

mzip :: ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m (a, b) #

mzipWith :: (a -> b -> c) -> ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m c #

munzip :: ExceptStringT m (a, b) -> (ExceptStringT m a, ExceptStringT m b) #

Foldable m => Foldable (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

fold :: Monoid m0 => ExceptStringT m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> ExceptStringT m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> ExceptStringT m a -> m0 #

foldr :: (a -> b -> b) -> b -> ExceptStringT m a -> b #

foldr' :: (a -> b -> b) -> b -> ExceptStringT m a -> b #

foldl :: (b -> a -> b) -> b -> ExceptStringT m a -> b #

foldl' :: (b -> a -> b) -> b -> ExceptStringT m a -> b #

foldr1 :: (a -> a -> a) -> ExceptStringT m a -> a #

foldl1 :: (a -> a -> a) -> ExceptStringT m a -> a #

toList :: ExceptStringT m a -> [a] #

null :: ExceptStringT m a -> Bool #

length :: ExceptStringT m a -> Int #

elem :: Eq a => a -> ExceptStringT m a -> Bool #

maximum :: Ord a => ExceptStringT m a -> a #

minimum :: Ord a => ExceptStringT m a -> a #

sum :: Num a => ExceptStringT m a -> a #

product :: Num a => ExceptStringT m a -> a #

Eq1 m => Eq1 (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

liftEq :: (a -> b -> Bool) -> ExceptStringT m a -> ExceptStringT m b -> Bool #

Ord1 m => Ord1 (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

liftCompare :: (a -> b -> Ordering) -> ExceptStringT m a -> ExceptStringT m b -> Ordering #

Read1 m => Read1 (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Show1 m => Show1 (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptStringT m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptStringT m a] -> ShowS #

Contravariant m => Contravariant (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

contramap :: (a' -> a) -> ExceptStringT m a -> ExceptStringT m a' #

(>$) :: b -> ExceptStringT m b -> ExceptStringT m a #

Monad m => Alternative (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Monad m => Applicative (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

pure :: a -> ExceptStringT m a #

(<*>) :: ExceptStringT m (a -> b) -> ExceptStringT m a -> ExceptStringT m b #

liftA2 :: (a -> b -> c) -> ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m c #

(*>) :: ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m b #

(<*) :: ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m a #

Functor m => Functor (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

fmap :: (a -> b) -> ExceptStringT m a -> ExceptStringT m b #

(<$) :: a -> ExceptStringT m b -> ExceptStringT m a #

Monad m => Monad (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

(>>=) :: ExceptStringT m a -> (a -> ExceptStringT m b) -> ExceptStringT m b #

(>>) :: ExceptStringT m a -> ExceptStringT m b -> ExceptStringT m b #

return :: a -> ExceptStringT m a #

Monad m => MonadPlus (ExceptStringT m) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

(Read1 m, Read a) => Read (ExceptStringT m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

(Show1 m, Show a) => Show (ExceptStringT m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

(Eq1 m, Eq a) => Eq (ExceptStringT m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

(==) :: ExceptStringT m a -> ExceptStringT m a -> Bool #

(/=) :: ExceptStringT m a -> ExceptStringT m a -> Bool #

(Ord1 m, Ord a) => Ord (ExceptStringT m a) Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

data TransformT (m :: Type -> Type) a #

Monad transformer version of Transform monad

Instances

Instances details
MonadTrans TransformT 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

lift :: Monad m => m a -> TransformT m a #

Monad m => MonadReader () (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

ask :: TransformT m () #

local :: (() -> ()) -> TransformT m a -> TransformT m a #

reader :: (() -> a) -> TransformT m a #

Monad m => MonadState Int (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

get :: TransformT m Int #

put :: Int -> TransformT m () #

state :: (Int -> (a, Int)) -> TransformT m a #

MonadFail m => MonadFail (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

fail :: String -> TransformT m a #

Monad m => Applicative (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

pure :: a -> TransformT m a #

(<*>) :: TransformT m (a -> b) -> TransformT m a -> TransformT m b #

liftA2 :: (a -> b -> c) -> TransformT m a -> TransformT m b -> TransformT m c #

(*>) :: TransformT m a -> TransformT m b -> TransformT m b #

(<*) :: TransformT m a -> TransformT m b -> TransformT m a #

Functor m => Functor (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

fmap :: (a -> b) -> TransformT m a -> TransformT m b #

(<$) :: a -> TransformT m b -> TransformT m a #

Monad m => Monad (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

(>>=) :: TransformT m a -> (a -> TransformT m b) -> TransformT m b #

(>>) :: TransformT m a -> TransformT m b -> TransformT m b #

return :: a -> TransformT m a #

Monad m => HasTransform (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

liftT :: Transform a -> TransformT m a #

Monad m => MonadWriter [String] (TransformT m) 
Instance details

Defined in Language.Haskell.GHC.ExactPrint.Transform

Methods

writer :: (a, [String]) -> TransformT m a #

tell :: [String] -> TransformT m () #

listen :: TransformT m a -> TransformT m (a, [String]) #

pass :: TransformT m (a, [String] -> [String]) -> TransformT m a #

data Log Source #

Constructors

LogShake Log 

Instances

Instances details
Show Log Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

showsPrec :: Int -> Log -> ShowS #

show :: Log -> String #

showList :: [Log] -> ShowS #

Pretty Log Source # 
Instance details

Defined in Development.IDE.GHC.ExactPrint

Methods

pretty :: Log -> Doc ann #

prettyList :: [Log] -> Doc ann #

Orphan instances