-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Exactprint refactorings for Haskell Language Server -- -- Please see the README on GitHub at -- https://github.com/haskell/haskell-language-server#readme @package hls-refactor-plugin @version 2.2.0.0 -- | This module contains compatibility constructs to write type signatures -- across multiple ghc-exactprint versions, accepting that anything more -- ambitious is pretty much impossible with the GHC 9.2 redesign of -- ghc-exactprint module Development.IDE.GHC.Compat.ExactPrint -- | 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. class Typeable a => ExactPrint a exactPrint :: ExactPrint ast => ast -> String -- | Transform concrete annotations into relative annotations which are -- more useful when transforming an AST. This corresponds to the earlier -- relativiseApiAnns. makeDeltaAst :: ExactPrint ast => ast -> ast -- | Annotated packages an AST fragment with the annotations -- necessary to exactPrint or transform that AST. data Annotated ast pattern Annotated :: ast -> ApiAnns -> Annotated ast ($sel:astA:Annotated) :: Annotated ast -> ast ($sel:annsA:Annotated) :: Annotated ast -> ApiAnns module Development.IDE.GHC.Dump -- | Show a GHC syntax tree in HTML. showAstDataHtml :: (Data a, ExactPrint a, Outputable a) => a -> SDoc -- | This module hosts various abstractions and utility functions to work -- with ghc-exactprint. module Development.IDE.GHC.ExactPrint -- | A transformation for grafting source trees together. Use the semigroup -- instance to combine Grafts, and run them via transform. newtype Graft m a Graft :: (DynFlags -> a -> TransformT m a) -> Graft m a [$sel:runGraft:Graft] :: Graft m a -> DynFlags -> a -> TransformT m a graftDecls :: forall a. HasDecls a => SrcSpan -> [LHsDecl GhcPs] -> Graft (Either String) a graftDeclsWithM :: forall a m. (HasDecls a, MonadFail m) => SrcSpan -> (LHsDecl GhcPs -> TransformT m (Maybe [LHsDecl GhcPs])) -> Graft m a -- | Given an LHSExpr, compute its exactprint annotations. Note -- that this function will throw away any existing annotations (and -- format) annotate :: (ASTElement l ast, Outputable l) => DynFlags -> Bool -> LocatedAn l ast -> TransformT (Either String) (LocatedAn l ast) -- | Given an LHsDecl, compute its exactprint annotations. annotateDecl :: DynFlags -> LHsDecl GhcPs -> TransformT (Either String) (LHsDecl GhcPs) hoistGraft :: (forall x. m x -> n x) -> Graft m a -> Graft n a graftWithM :: forall ast m a l. (MonadFail m, Data a, Typeable l, ASTElement l ast) => SrcSpan -> (LocatedAn l ast -> TransformT m (Maybe (LocatedAn l ast))) -> Graft m a graftExprWithM :: forall m a. (MonadFail m, Data a) => SrcSpan -> (LHsExpr GhcPs -> TransformT m (Maybe (LHsExpr GhcPs))) -> Graft m a -- | Run the given transformation only on the smallest node in the tree -- that contains the SrcSpan. genericGraftWithSmallestM :: forall m a ast. (Monad m, Data a, Typeable ast) => Proxy (Located ast) -> 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. genericGraftWithLargestM :: forall m a ast. (Monad m, Data a, Typeable ast) => Proxy (Located ast) -> SrcSpan -> (DynFlags -> ast -> GenericM (TransformT m)) -> Graft m a graftSmallestDeclsWithM :: forall a. HasDecls a => SrcSpan -> (LHsDecl GhcPs -> TransformT (Either String) (Maybe [LHsDecl GhcPs])) -> Graft (Either String) a -- | Convert a Graft into a WorkspaceEdit. transform :: DynFlags -> ClientCapabilities -> VersionedTextDocumentIdentifier -> Graft (Either String) ParsedSource -> Annotated ParsedSource -> Either String WorkspaceEdit -- | Convert a Graft into a WorkspaceEdit. transformM :: Monad m => DynFlags -> ClientCapabilities -> VersionedTextDocumentIdentifier -> Graft (ExceptStringT m) ParsedSource -> Annotated ParsedSource -> m (Either String WorkspaceEdit) -- | 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. class Typeable a => ExactPrint a getAnnotationEntry :: ExactPrint a => a -> Entry setAnnotationAnchor :: ExactPrint a => a -> Anchor -> EpAnnComments -> a exact :: forall (m :: Type -> Type) w. (ExactPrint a, Monad m, Monoid w) => a -> EP w m a -- | 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 not -- declaration matched, then Nothing is returned. 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) -- | Modify each LMatch in a MatchGroup modifyMgMatchesT :: Monad m => MatchGroup GhcPs (LHsExpr GhcPs) -> (LMatch GhcPs (LHsExpr GhcPs) -> TransformT m (LMatch GhcPs (LHsExpr GhcPs))) -> TransformT m (MatchGroup GhcPs (LHsExpr GhcPs)) -- | Modify the each LMatch in a MatchGroup 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) -- | 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: -- -- modifySigWithM :: forall a m. (HasDecls a, Monad m) => IdP GhcPs -> (LHsSigType GhcPs -> LHsSigType GhcPs) -> a -> TransformT m a genAnchor1 :: Anchor setPrecedingLines :: Default t => LocatedAn t a -> Int -> Int -> LocatedAn t a addParens :: Bool -> NameAnn -> NameAnn addParensToCtxt :: Maybe EpaLocation -> AnnContext -> AnnContext modifyAnns :: LocatedAn a ast -> (a -> a) -> LocatedAn a ast removeComma :: SrcSpanAnnA -> SrcSpanAnnA -- | Equality on SrcSpan's. Ignores the (Maybe BufSpan) field of SrcSpan's. eqSrcSpan :: SrcSpan -> SrcSpan -> Bool epl :: Int -> EpaLocation epAnn :: SrcSpan -> ann -> EpAnn ann removeTrailingComma :: GenLocated SrcSpanAnnA ast -> GenLocated SrcSpanAnnA ast annotateParsedSource :: ParsedModule -> Annotated ParsedSource -- | Get the latest version of the annotated parse source with comments. getAnnotatedParsedSourceRule :: Recorder (WithPriority Log) -> Rules () data GetAnnotatedParsedSource GetAnnotatedParsedSource :: GetAnnotatedParsedSource class (Data ast, Typeable l, Outputable l, Outputable ast, Default l) => ASTElement l ast | ast -> l parseAST :: ASTElement l ast => Parser (LocatedAn l ast) maybeParensAST :: ASTElement l ast => LocatedAn l ast -> LocatedAn l ast -- | 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. graft :: forall a. (ASTElement l ast, Data a) => SrcSpan -> LocatedAn l ast -> Graft (Either String) a newtype ExceptStringT m a ExceptStringT :: ExceptT String m a -> ExceptStringT m a [$sel:runExceptString:ExceptStringT] :: ExceptStringT m a -> ExceptT String m a -- | Monad transformer version of Transform monad data TransformT (m :: Type -> Type) a data Log LogShake :: Log -> Log instance GHC.Show.Show Development.IDE.GHC.ExactPrint.Log instance GHC.Generics.Generic Development.IDE.GHC.ExactPrint.GetAnnotatedParsedSource instance GHC.Show.Show Development.IDE.GHC.ExactPrint.GetAnnotatedParsedSource instance GHC.Classes.Eq Development.IDE.GHC.ExactPrint.GetAnnotatedParsedSource instance (Data.Functor.Classes.Read1 m, GHC.Read.Read a) => GHC.Read.Read (Development.IDE.GHC.ExactPrint.ExceptStringT m a) instance (Data.Functor.Classes.Show1 m, GHC.Show.Show a) => GHC.Show.Show (Development.IDE.GHC.ExactPrint.ExceptStringT m a) instance (Data.Functor.Classes.Ord1 m, GHC.Classes.Ord a) => GHC.Classes.Ord (Development.IDE.GHC.ExactPrint.ExceptStringT m a) instance (Data.Functor.Classes.Eq1 m, GHC.Classes.Eq a) => GHC.Classes.Eq (Development.IDE.GHC.ExactPrint.ExceptStringT m a) instance GHC.Base.Monad m => GHC.Base.MonadPlus (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Control.Monad.Zip.MonadZip m => Control.Monad.Zip.MonadZip (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Functor.Classes.Read1 m => Data.Functor.Classes.Read1 (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Functor.Classes.Show1 m => Data.Functor.Classes.Show1 (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Functor.Classes.Ord1 m => Data.Functor.Classes.Ord1 (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Functor.Classes.Eq1 m => Data.Functor.Classes.Eq1 (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Functor.Contravariant.Contravariant m => Data.Functor.Contravariant.Contravariant (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Data.Foldable.Foldable m => Data.Foldable.Foldable (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance GHC.Base.Monad m => GHC.Base.Alternative (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance GHC.Base.Functor m => GHC.Base.Functor (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance GHC.Base.Monad m => GHC.Base.Monad (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance Control.Monad.Trans.Class.MonadTrans Development.IDE.GHC.ExactPrint.ExceptStringT instance (p GHC.Types.~ GHC.Hs.Extension.GhcPs) => Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.AnnListItem (Language.Haskell.Syntax.Expr.HsExpr p) instance (p GHC.Types.~ GHC.Hs.Extension.GhcPs) => Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.AnnListItem (Language.Haskell.Syntax.Pat.Pat p) instance (p GHC.Types.~ GHC.Hs.Extension.GhcPs) => Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.AnnListItem (Language.Haskell.Syntax.Type.HsType p) instance (p GHC.Types.~ GHC.Hs.Extension.GhcPs) => Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.AnnListItem (Language.Haskell.Syntax.Decls.HsDecl p) instance (p GHC.Types.~ GHC.Hs.Extension.GhcPs) => Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.AnnListItem (GHC.Hs.ImpExp.ImportDecl p) instance Development.IDE.GHC.ExactPrint.ASTElement GHC.Parser.Annotation.NameAnn GHC.Types.Name.Reader.RdrName instance GHC.Base.Monad m => Control.Monad.Fail.MonadFail (Development.IDE.GHC.ExactPrint.ExceptStringT m) instance GHC.Base.Monad m => GHC.Base.Semigroup (Development.IDE.GHC.ExactPrint.Graft m a) instance GHC.Base.Monad m => GHC.Base.Monoid (Development.IDE.GHC.ExactPrint.Graft m a) instance Data.Hashable.Class.Hashable Development.IDE.GHC.ExactPrint.GetAnnotatedParsedSource instance Control.DeepSeq.NFData Development.IDE.GHC.ExactPrint.GetAnnotatedParsedSource instance Prettyprinter.Internal.Pretty Development.IDE.GHC.ExactPrint.Log instance GHC.Show.Show (Retrie.ExactPrint.Annotated.Annotated GHC.ParsedSource) instance Control.DeepSeq.NFData (Retrie.ExactPrint.Annotated.Annotated GHC.ParsedSource) module Development.IDE.Plugin.CodeAction.Util timestamp :: POSIXTime debugAST :: Bool -- | Prints an Outputable value to stderr and to an HTML file for -- further inspection traceAst :: (Data a, ExactPrint a, Outputable a, HasCallStack) => String -> a -> a module Development.IDE.Plugin.CodeAction -- | Add the ability for a plugin to call GetAnnotatedParsedSource mkExactprintPluginDescriptor :: Recorder (WithPriority Log) -> PluginDescriptor a -> PluginDescriptor a iePluginDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState typeSigsPluginDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState bindingsPluginDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState fillHolePluginDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState extendImportPluginDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState matchRegExMultipleImports :: Text -> Maybe (Text, [(Text, Text)]) instance GHC.Classes.Eq Development.IDE.Plugin.CodeAction.ExportsAs instance GHC.Classes.Ord Development.IDE.Plugin.CodeAction.NewImport instance GHC.Classes.Eq Development.IDE.Plugin.CodeAction.NewImport instance GHC.Show.Show Development.IDE.Plugin.CodeAction.NewImport instance GHC.Classes.Eq Development.IDE.Plugin.CodeAction.ImportSuggestion instance GHC.Show.Show Development.IDE.Plugin.CodeAction.NotInScope