| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Haskell.GHC.ExactPrint.ExactPrint
Contents
Synopsis
- class Typeable a => ExactPrint a where
- getAnnotationEntry :: a -> Entry
- setAnnotationAnchor :: a -> Anchor -> [TrailingAnn] -> EpAnnComments -> a
- exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => a -> EP w m a
- exactPrint :: ExactPrint ast => ast -> String
- exactPrintWithOptions :: (ExactPrint ast, Monoid b, Monad m) => EPOptions m b -> ast -> m (ast, b)
- makeDeltaAst :: ExactPrint ast => ast -> ast
- data EPOptions (m :: Type -> Type) a
- stringOptions :: EPOptions Identity String
- epOptions :: (String -> m a) -> (String -> m a) -> EPOptions m a
- deltaOptions :: EPOptions Identity ()
Documentation
class Typeable a => ExactPrint a where Source #
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 Source #
setAnnotationAnchor :: a -> Anchor -> [TrailingAnn] -> EpAnnComments -> a Source #
exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => a -> EP w m a Source #
Instances
exactPrint :: ExactPrint ast => ast -> String Source #
exactPrintWithOptions :: (ExactPrint ast, Monoid b, Monad m) => EPOptions m b -> ast -> m (ast, b) Source #
The additional option to specify the printing configuration.
makeDeltaAst :: ExactPrint ast => ast -> ast Source #
Transform concrete annotations into relative annotations. This should be unnecessary from GHC 9.10
Configuration
data EPOptions (m :: Type -> Type) a Source #
The R part of RWS. The environment. Updated via local as we
enter a new AST element, having a different anchor point.
stringOptions :: EPOptions Identity String Source #
Options which can be used to print as a normal String.
epOptions :: (String -> m a) -> (String -> m a) -> EPOptions m a Source #
Helper to create a EPOptions
deltaOptions :: EPOptions Identity () Source #
Options which can be used to simply update the AST to be in delta form, without generating output