| 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 :: (forall ast. Data ast => Located ast -> a -> m a) -> (String -> m a) -> (String -> m a) -> Rigidity -> Bool -> EPOptions m a
- deltaOptions :: EPOptions Identity ()
Documentation
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 -> [TrailingAnn] -> EpAnnComments -> a #
exact :: forall (m :: Type -> Type) w. (Monad m, Monoid w) => a -> EP w m a #
Instances
exactPrint :: ExactPrint ast => ast -> String #
exactPrintWithOptions :: (ExactPrint ast, Monoid b, Monad m) => EPOptions m b -> ast -> m (ast, b) #
The additional option to specify the rigidity and printing configuration.
makeDeltaAst :: ExactPrint ast => ast -> ast #
Transform concrete annotations into relative annotations which
are more useful when transforming an AST. This corresponds to the
earlier relativiseApiAnns.
Configuration
data EPOptions (m :: Type -> Type) a #
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 #
Options which can be used to print as a normal String.
epOptions :: (forall ast. Data ast => Located ast -> a -> m a) -> (String -> m a) -> (String -> m a) -> Rigidity -> Bool -> EPOptions m a #
Helper to create a EPOptions
deltaOptions :: EPOptions Identity () #
Options which can be used to simply update the AST to be in delta form, without generating output