morley-0.2.0.1: Developer tools for the Michelson Language

Safe HaskellNone
LanguageHaskell2010

Michelson.Printer.Util

Synopsis

Documentation

class RenderDoc a where Source #

Generalize converting a type into a Text.PrettyPrint.Leijen.Text.Doc. Used to pretty print Michelson code and define Fmt.Buildable instances.

Minimal complete definition

renderDoc

Methods

renderDoc :: a -> Doc Source #

isRenderable :: a -> Bool Source #

Whether a value can be represented in Michelson code. Normally either all values of some type are renderable or not renderable. However, in case of instructions we have extra instructions which should not be rendered. Note: it's not suficcient to just return mempty for such instructions, because sometimes we want to print lists of instructions and we need to ignore them complete (to avoid putting redundant separators).

Instances
RenderDoc VarAnn Source # 
Instance details

Defined in Michelson.Untyped.Annotation

RenderDoc FieldAnn Source # 
Instance details

Defined in Michelson.Untyped.Annotation

RenderDoc TypeAnn Source # 
Instance details

Defined in Michelson.Untyped.Annotation

RenderDoc CT Source # 
Instance details

Defined in Michelson.Untyped.Type

RenderDoc T Source # 
Instance details

Defined in Michelson.Untyped.Type

RenderDoc Comparable Source # 
Instance details

Defined in Michelson.Untyped.Type

RenderDoc Type Source # 
Instance details

Defined in Michelson.Untyped.Type

RenderDoc ExpandedOp Source # 
Instance details

Defined in Michelson.Untyped.Instr

RenderDoc Op Source # 
Instance details

Defined in Michelson.Untyped.Instr

RenderDoc ParsedOp Source # 
Instance details

Defined in Morley.Types

RenderDoc op => RenderDoc (Elt op) Source # 
Instance details

Defined in Michelson.Untyped.Value

Methods

renderDoc :: Elt op -> Doc Source #

isRenderable :: Elt op -> Bool Source #

RenderDoc op => RenderDoc (Value op) Source # 
Instance details

Defined in Michelson.Untyped.Value

RenderDoc op => RenderDoc (Contract op) Source # 
Instance details

Defined in Michelson.Untyped.Contract

RenderDoc op => RenderDoc (InstrAbstract op) Source # 
Instance details

Defined in Michelson.Untyped.Instr

printDoc :: Doc -> Text Source #

Convert Doc to Text with a line width of 80.

renderOps :: RenderDoc op => Bool -> NonEmpty op -> Doc Source #

Generic way to render the different op types that get passed to a contract.

renderOpsList :: RenderDoc op => Bool -> [op] -> Doc Source #

spaces :: Int -> Doc Source #

Create a specific number of spaces.

wrapInParens :: NonEmpty Doc -> Doc Source #

Wrap documents in parentheses if there are two or more in the list.

buildRenderDoc :: RenderDoc a => a -> Builder Source #

Turn something that is instance of RenderDoc into a Builder. It's formatted the same way as printDoc formats docs.