Agda-2.6.2.2: A dependently typed functional programming language and proof assistant

Safe Haskell | Safe-Inferred
Language | Haskell2010

Agda.Compiler.JS.Pretty

Synopsis

- data Doc
  - = Doc String
  - | Indent Int Doc
  - | Group Doc
  - | Beside Doc Doc
  - | Above Doc Doc
  - | Enclose Doc Doc Doc
  - | Space
  - | Empty
- minifiedCodeLinesLength :: Int
- render :: Bool -> Doc -> String
- ($+$) :: Doc -> Doc -> Doc
- ($++$) :: Doc -> Doc -> Doc
- (<+>) :: Doc -> Doc -> Doc
- text :: String -> Doc
- group :: Doc -> Doc
- indentBy :: Int -> Doc -> Doc
- enclose :: Doc -> Doc -> Doc -> Doc
- space :: Doc
- indent :: Doc -> Doc
- hcat :: [Doc] -> Doc
- vcat :: [Doc] -> Doc
- vsep :: [Doc] -> Doc
- punctuate :: Doc -> [Doc] -> Doc
- parens :: Doc -> Doc
- brackets :: Doc -> Doc
- braces :: Doc -> Doc
- mparens :: Bool -> Doc -> Doc
- unescape :: Char -> String
- unescapes :: String -> Doc
- class Pretty a where
  - pretty :: (Nat, Bool) -> a -> Doc
- prettyShow :: Pretty a => Bool -> a -> String
- class Pretties a where
  - pretties :: (Nat, Bool) -> a -> [Doc]
- block :: (Nat, Bool) -> Exp -> Doc
- modname :: GlobalId -> Doc
- exports :: (Nat, Bool) -> Set JSQName -> [Export] -> Doc
- variableName :: String -> String
- isValidJSIdent :: String -> Bool

# Documentation

data Doc Source #

Constructors

Doc String |
Indent Int Doc |
Group Doc |
Beside Doc Doc |
Above Doc Doc |
Enclose Doc Doc Doc |
Space |
Empty |

#### Instances

Instances details

IsString Doc Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods fromString :: String -> Doc Source #
Monoid Doc Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods mempty :: Doc Source # mappend :: Doc -> Doc -> Doc Source # mconcat :: [Doc] -> Doc Source #
Semigroup Doc Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods (<>) :: Doc -> Doc -> Doc Source # sconcat :: NonEmpty Doc -> Doc Source # stimes :: Integral b => b -> Doc -> Doc Source #

minifiedCodeLinesLength :: Int Source #

render :: Bool -> Doc -> String Source #

($+$) :: Doc -> Doc -> Doc infixr 5 Source #

($++$) :: Doc -> Doc -> Doc infixr 5 Source #

Separate by blank line.

(<+>) :: Doc -> Doc -> Doc infixr 6 Source #

Separate by space that will be removed by minify.

For non-removable space, use `d <> " " <> d'`.

text :: String -> Doc Source #

group :: Doc -> Doc Source #

indentBy :: Int -> Doc -> Doc Source #

enclose :: Doc -> Doc -> Doc -> Doc Source #

space :: Doc Source #

indent :: Doc -> Doc Source #

hcat :: [Doc] -> Doc Source #

vcat :: [Doc] -> Doc Source #

vsep :: [Doc] -> Doc Source #

Concatenate vertically, separated by blank lines.

punctuate :: Doc -> [Doc] -> Doc Source #

parens :: Doc -> Doc Source #

brackets :: Doc -> Doc Source #

braces :: Doc -> Doc Source #

mparens :: Bool -> Doc -> Doc Source #

Apply `parens` to `Doc` if boolean is true.

unescape :: Char -> String Source #

unescapes :: String -> Doc Source #

class Pretty a where Source #

Methods

pretty :: (Nat, Bool) -> a -> Doc Source #

#### Instances

Instances details

Pretty Comment Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> Comment -> Doc Source #
Pretty Exp Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> Exp -> Doc Source #
Pretty GlobalId Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> GlobalId -> Doc Source #
Pretty LocalId Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> LocalId -> Doc Source #
Pretty MemberId Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> MemberId -> Doc Source #
Pretty Module Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> Module -> Doc Source #
Pretty a => Pretty (Maybe a) Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> Maybe a -> Doc Source #
Pretty [(GlobalId, Export)] Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> [(GlobalId, Export)] -> Doc Source #
(Pretty a, Pretty b) => Pretty (a, b) Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretty :: (Nat, Bool) -> (a, b) -> Doc Source #

prettyShow :: Pretty a => Bool -> a -> String Source #

class Pretties a where Source #

Methods

pretties :: (Nat, Bool) -> a -> [Doc] Source #

#### Instances

Instances details

Pretty a => Pretties (List1 a) Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretties :: (Nat, Bool) -> List1 a -> [Doc] Source #
Pretty a => Pretties [a] Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretties :: (Nat, Bool) -> [a] -> [Doc] Source #
(Pretty a, Pretty b) => Pretties (Map a b) Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretties :: (Nat, Bool) -> Map a b -> [Doc] Source #

block :: (Nat, Bool) -> Exp -> Doc Source #

modname :: GlobalId -> Doc Source #

exports :: (Nat, Bool) -> Set JSQName -> [Export] -> Doc Source #

variableName :: String -> String Source #

isValidJSIdent :: String -> Bool Source #

Check if a string is a valid JS identifier. The check ignores keywords as we prepend z_ to our identifiers. The check is conservative and may not admit all valid JS identifiers.