purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.Docs.RenderedCode.Types

Description

Data types and functions for representing a simplified form of PureScript code, intended for use in e.g. HTML documentation.

Synopsis

- data RenderedCodeElement
  - = Syntax Text
  - | Keyword Text
  - | Space
  - | Symbol Namespace Text Link
  - | Role Text
- data ContainingModule
  - = ThisModule
  - | OtherModule ModuleName
- asContainingModule :: Parse Text ContainingModule
- maybeToContainingModule :: Maybe ModuleName -> ContainingModule
- fromQualified :: Qualified a -> (ContainingModule, a)
- data Namespace
  - = ValueLevel
  - | TypeLevel
- data Link
  - = NoLink
  - | Link ContainingModule
- type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName)))
- data RenderedCode
- outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a
- sp :: RenderedCode
- syntax :: Text -> RenderedCode
- keyword :: Text -> RenderedCode
- keywordForall :: RenderedCode
- keywordData :: RenderedCode
- keywordType :: RenderedCode
- keywordClass :: RenderedCode
- keywordWhere :: RenderedCode
- keywordFixity :: Associativity -> RenderedCode
- keywordAs :: RenderedCode
- ident :: Qualified Ident -> RenderedCode
- dataCtor :: Qualified (ProperName 'ConstructorName) -> RenderedCode
- typeCtor :: Qualified (ProperName 'TypeName) -> RenderedCode
- typeOp :: Qualified (OpName 'TypeOpName) -> RenderedCode
- typeVar :: Text -> RenderedCode
- roleAnn :: Maybe Text -> RenderedCode
- alias :: FixityAlias -> RenderedCode
- aliasName :: FixityAlias -> Text -> RenderedCode

# Documentation

data RenderedCodeElement #

A single element in a rendered code fragment. The intention is to support multiple output formats. For example, plain text, or highlighted HTML.

Constructors

Syntax Text |
Keyword Text |
Space |
Symbol Namespace Text Link | Any symbol which you might or might not want to link to, in any namespace (value, type, or kind). Note that this is not related to the kind called Symbol for type-level strings.
Role Text |

#### Instances

Instances details

ToJSON RenderedCodeElement # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods toJSON :: RenderedCodeElement -> Value # toEncoding :: RenderedCodeElement -> Encoding # toJSONList :: [RenderedCodeElement] -> Value # toEncodingList :: [RenderedCodeElement] -> Encoding # omitField :: RenderedCodeElement -> Bool #
Show RenderedCodeElement # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods showsPrec :: Int -> RenderedCodeElement -> ShowS # show :: RenderedCodeElement -> String # showList :: [RenderedCodeElement] -> ShowS #
Eq RenderedCodeElement # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (==) :: RenderedCodeElement -> RenderedCodeElement -> Bool # (/=) :: RenderedCodeElement -> RenderedCodeElement -> Bool #
Ord RenderedCodeElement # |

Instance details

Defined in Language.PureScript.Docs.RenderedCode.Types

Methods

compare :: RenderedCodeElement -> RenderedCodeElement -> Ordering #

(<) :: RenderedCodeElement -> RenderedCodeElement -> Bool #

(<=) :: RenderedCodeElement -> RenderedCodeElement -> Bool #

(>) :: RenderedCodeElement -> RenderedCodeElement -> Bool #

(>=) :: RenderedCodeElement -> RenderedCodeElement -> Bool #

max :: RenderedCodeElement -> RenderedCodeElement -> RenderedCodeElement #

min :: RenderedCodeElement -> RenderedCodeElement -> RenderedCodeElement #

data ContainingModule #

This type is isomorphic to `Maybe` `ModuleName`. It makes code a bit easier to read, as the meaning is more explicit.

Constructors

ThisModule |
OtherModule ModuleName |

#### Instances

Instances details

FromJSON ContainingModule # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods parseJSON :: Value -> Parser ContainingModule # parseJSONList :: Value -> Parser [ContainingModule] # omittedField :: Maybe ContainingModule #
ToJSON ContainingModule # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods toJSON :: ContainingModule -> Value # toEncoding :: ContainingModule -> Encoding # toJSONList :: [ContainingModule] -> Value # toEncodingList :: [ContainingModule] -> Encoding # omitField :: ContainingModule -> Bool #
Show ContainingModule # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods showsPrec :: Int -> ContainingModule -> ShowS # show :: ContainingModule -> String # showList :: [ContainingModule] -> ShowS #
Eq ContainingModule # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (==) :: ContainingModule -> ContainingModule -> Bool # (/=) :: ContainingModule -> ContainingModule -> Bool #
Ord ContainingModule # |

Instance details

Defined in Language.PureScript.Docs.RenderedCode.Types

Methods

compare :: ContainingModule -> ContainingModule -> Ordering #

(<) :: ContainingModule -> ContainingModule -> Bool #

(<=) :: ContainingModule -> ContainingModule -> Bool #

(>) :: ContainingModule -> ContainingModule -> Bool #

(>=) :: ContainingModule -> ContainingModule -> Bool #

max :: ContainingModule -> ContainingModule -> ContainingModule #

min :: ContainingModule -> ContainingModule -> ContainingModule #

asContainingModule :: Parse Text ContainingModule #

maybeToContainingModule :: Maybe ModuleName -> ContainingModule #

Convert a `Maybe` `ModuleName` to a `ContainingModule`, using the obvious isomorphism.

fromQualified :: Qualified a -> (ContainingModule, a) #

data Namespace #

Constructors

ValueLevel |
TypeLevel |

#### Instances

Instances details

FromJSON Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods parseJSON :: Value -> Parser Namespace # parseJSONList :: Value -> Parser [Namespace] # omittedField :: Maybe Namespace #
ToJSON Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods toJSON :: Namespace -> Value # toEncoding :: Namespace -> Encoding # toJSONList :: [Namespace] -> Value # toEncodingList :: [Namespace] -> Encoding # omitField :: Namespace -> Bool #
NFData Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods rnf :: Namespace -> () #
Generic Namespace # |

Instance details

Defined in Language.PureScript.Docs.RenderedCode.Types

Associated Types

type Rep Namespace |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types type Rep Namespace = D1 ('MetaData "Namespace" "Language.PureScript.Docs.RenderedCode.Types" "purescript-0.15.15-8K0LbmS63k4ILju2RsIrDp" 'False) (C1 ('MetaCons "ValueLevel" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TypeLevel" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Namespace -> Rep Namespace x #

to :: Rep Namespace x -> Namespace #

Show Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods showsPrec :: Int -> Namespace -> ShowS # show :: Namespace -> String # showList :: [Namespace] -> ShowS #
Eq Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (==) :: Namespace -> Namespace -> Bool # (/=) :: Namespace -> Namespace -> Bool #
Ord Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods compare :: Namespace -> Namespace -> Ordering # (<) :: Namespace -> Namespace -> Bool # (<=) :: Namespace -> Namespace -> Bool # (>) :: Namespace -> Namespace -> Bool # (>=) :: Namespace -> Namespace -> Bool # max :: Namespace -> Namespace -> Namespace # min :: Namespace -> Namespace -> Namespace #
type Rep Namespace # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types type Rep Namespace = D1 ('MetaData "Namespace" "Language.PureScript.Docs.RenderedCode.Types" "purescript-0.15.15-8K0LbmS63k4ILju2RsIrDp" 'False) (C1 ('MetaCons "ValueLevel" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TypeLevel" 'PrefixI 'False) (U1 :: Type -> Type))

data Link #

Constructors

NoLink |
Link ContainingModule |

#### Instances

Instances details

FromJSON Link # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods parseJSON :: Value -> Parser Link # parseJSONList :: Value -> Parser [Link] # omittedField :: Maybe Link #
ToJSON Link # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods toJSON :: Link -> Value # toEncoding :: Link -> Encoding # toJSONList :: [Link] -> Value # toEncodingList :: [Link] -> Encoding # omitField :: Link -> Bool #
Show Link # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods showsPrec :: Int -> Link -> ShowS # show :: Link -> String # showList :: [Link] -> ShowS #
Eq Link # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (==) :: Link -> Link -> Bool # (/=) :: Link -> Link -> Bool #
Ord Link # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods compare :: Link -> Link -> Ordering # (<) :: Link -> Link -> Bool # (<=) :: Link -> Link -> Bool # (>) :: Link -> Link -> Bool # (>=) :: Link -> Link -> Bool # max :: Link -> Link -> Link # min :: Link -> Link -> Link #

type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName))) #

data RenderedCode #

A type representing a highly simplified version of PureScript code, intended for use in output formats like plain text or HTML.

#### Instances

Instances details

ToJSON RenderedCode # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods toJSON :: RenderedCode -> Value # toEncoding :: RenderedCode -> Encoding # toJSONList :: [RenderedCode] -> Value # toEncodingList :: [RenderedCode] -> Encoding # omitField :: RenderedCode -> Bool #
Monoid RenderedCode # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods mempty :: RenderedCode # mappend :: RenderedCode -> RenderedCode -> RenderedCode # mconcat :: [RenderedCode] -> RenderedCode #
Semigroup RenderedCode # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (<>) :: RenderedCode -> RenderedCode -> RenderedCode # sconcat :: NonEmpty RenderedCode -> RenderedCode # stimes :: Integral b => b -> RenderedCode -> RenderedCode #
Show RenderedCode # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods showsPrec :: Int -> RenderedCode -> ShowS # show :: RenderedCode -> String # showList :: [RenderedCode] -> ShowS #
Eq RenderedCode # |
Instance details Defined in Language.PureScript.Docs.RenderedCode.Types Methods (==) :: RenderedCode -> RenderedCode -> Bool # (/=) :: RenderedCode -> RenderedCode -> Bool #
Ord RenderedCode # |

Instance details

Defined in Language.PureScript.Docs.RenderedCode.Types

Methods

compare :: RenderedCode -> RenderedCode -> Ordering #

(<) :: RenderedCode -> RenderedCode -> Bool #

(<=) :: RenderedCode -> RenderedCode -> Bool #

(>) :: RenderedCode -> RenderedCode -> Bool #

(>=) :: RenderedCode -> RenderedCode -> Bool #

max :: RenderedCode -> RenderedCode -> RenderedCode #

min :: RenderedCode -> RenderedCode -> RenderedCode #

outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a #

This function allows conversion of a `RenderedCode` value into a value of some other type (for example, plain text, or HTML). The first argument is a function specifying how each individual `RenderedCodeElement` should be rendered.

sp :: RenderedCode #

A `RenderedCode` fragment representing a space.

syntax :: Text -> RenderedCode #

keyword :: Text -> RenderedCode #

keywordForall :: RenderedCode #

keywordData :: RenderedCode #

keywordType :: RenderedCode #

keywordClass :: RenderedCode #

keywordWhere :: RenderedCode #

keywordFixity :: Associativity -> RenderedCode #

keywordAs :: RenderedCode #

ident :: Qualified Ident -> RenderedCode #

dataCtor :: Qualified (ProperName 'ConstructorName) -> RenderedCode #

typeCtor :: Qualified (ProperName 'TypeName) -> RenderedCode #

typeOp :: Qualified (OpName 'TypeOpName) -> RenderedCode #

typeVar :: Text -> RenderedCode #

roleAnn :: Maybe Text -> RenderedCode #

alias :: FixityAlias -> RenderedCode #

aliasName :: FixityAlias -> Text -> RenderedCode #