Safe Haskell | None |
---|---|
Language | Haskell2010 |
Typst.Types
Synopsis
- data RE
- data Val
- = VNone
- | VAuto
- | VBoolean !Bool
- | VInteger !Integer
- | VFloat !Double
- | VRatio !Rational
- | VLength !Length
- | VAlignment (Maybe Horiz) (Maybe Vert)
- | VAngle !Double
- | VFraction !Double
- | VColor !Color
- | VSymbol !Symbol
- | VString !Text
- | VRegex !RE
- | VDateTime (Maybe Day) (Maybe DiffTime)
- | VContent (Seq Content)
- | VArray (Vector Val)
- | VDict (OMap Identifier Val)
- | VTermItem (Seq Content) (Seq Content)
- | VDirection Direction
- | VFunction (Maybe Identifier) (Map Identifier Val) Function
- | VArguments Arguments
- | VLabel !Text
- | VCounter !Counter
- | VSelector !Selector
- | VModule Identifier (Map Identifier Val)
- | VStyles
- | VVersion [Integer]
- | VBytes ByteString
- | VType !ValType
- data ValType
- = TNone
- | TAuto
- | TBoolean
- | TInteger
- | TFloat
- | TRatio
- | TLength
- | TAlignment
- | TAngle
- | TFraction
- | TColor
- | TSymbol
- | TString
- | TRegex
- | TDateTime
- | TContent
- | TArray
- | TDict
- | TTermItem
- | TDirection
- | TFunction
- | TArguments
- | TModule
- | TSelector
- | TStyles
- | TLabel
- | TCounter
- | TLocation
- | TVersion
- | TBytes
- | TType
- | TAny
- | ValType :|: ValType
- valType :: Val -> ValType
- hasType :: ValType -> Val -> Bool
- class FromVal a where
- class Negatable a where
- maybeNegate :: a -> Maybe a
- class Negatable a => Summable a where
- maybePlus :: a -> a -> Maybe a
- maybeMinus :: a -> a -> Maybe a
- class Multipliable a where
- maybeTimes :: a -> a -> Maybe a
- maybeDividedBy :: a -> a -> Maybe a
- data Selector
- = SelectElement Identifier [(Identifier, Val)]
- | SelectString !Text
- | SelectRegex !RE
- | SelectLabel !Text
- | SelectOr Selector Selector
- | SelectAnd Selector Selector
- | SelectBefore Selector Selector
- | SelectAfter Selector Selector
- data Symbol = Symbol {
- symDefault :: !Text
- symAccent :: !Bool
- symVariants :: [(Set Text, Text)]
- data Content
- = Txt !Text
- | Lab !Text
- | Elt {
- eltName :: Identifier
- eltPos :: Maybe SourcePos
- eltFields :: Map Identifier Val
- newtype Function = Function (forall (m :: Type -> Type). Monad m => Arguments -> MP m Val)
- data Arguments = Arguments {
- positional :: [Val]
- named :: OMap Identifier Val
- getPositionalArg :: (MonadFail m, MonadPlus m, FromVal a) => Int -> Arguments -> m a
- getNamedArg :: (MonadFail m, MonadPlus m, FromVal a) => Identifier -> Arguments -> m a
- class Compare a where
- comp :: a -> a -> Maybe Ordering
- type MP (m :: Type -> Type) = ParsecT [Markup] (EvalState m) m
- data Scope
- data FlowDirective
- = FlowNormal
- | FlowBreak
- | FlowContinue
- | FlowReturn Bool
- data Operations (m :: Type -> Type) = Operations {
- loadBytes :: FilePath -> m ByteString
- currentUTCTime :: m UTCTime
- lookupEnvVar :: String -> m (Maybe String)
- checkExistence :: FilePath -> m Bool
- data XdgDirectory
- data EvalState (m :: Type -> Type) = EvalState {
- evalIdentifiers :: [(Scope, Map Identifier Val)]
- evalStandardIdentifiers :: [(Scope, Map Identifier Val)]
- evalMathIdentifiers :: [(Scope, Map Identifier Val)]
- evalCounters :: Map Counter Integer
- evalMath :: Bool
- evalShowRules :: [ShowRule]
- evalNextShowRuleIdentifier :: Int
- evalStyles :: Map Identifier Arguments
- evalFlowDirective :: FlowDirective
- evalPackageRoot :: FilePath
- evalLocalDir :: FilePath
- evalOperations :: Operations m
- emptyEvalState :: forall (m :: Type -> Type). EvalState m
- data ShowRule = ShowRule Int Selector (forall (m :: Type -> Type). Monad m => Content -> MP m (Seq Content))
- data Counter
- = CounterCustom !Text
- | CounterLabel !Text
- | CounterSelector !Selector
- | CounterPage
- data LUnit
- data Length
- renderLength :: Bool -> Length -> Text
- data Horiz
- data Vert
- data Color
- data Direction
- newtype Identifier = Identifier Text
- lookupIdentifier :: forall (m :: Type -> Type). Monad m => Identifier -> MP m Val
- joinVals :: MonadFail m => Val -> Val -> m Val
- prettyVal :: Val -> Doc
- valToContent :: Val -> Seq Content
- prettyType :: ValType -> Text
- repr :: Val -> Text
- data Attempt a
Documentation
A regular expression. Note that typst-hs does not use the same Regex engine as Typst. See issue #28.
A Typst value. More documentation can be found in the Foundations chapter of the Typst reference manual. A more concise (but somewhat outdated) summary can also be found in L. Mädje "Typst: a programmable markup language for typesetting", page 32-33.
Constructors
VNone | The |
VAuto | The |
VBoolean !Bool | A |
VInteger !Integer | An |
VFloat !Double | A |
VRatio !Rational | A |
VLength !Length | A |
VAlignment (Maybe Horiz) (Maybe Vert) | An |
VAngle !Double | An |
VFraction !Double | A |
VColor !Color | A |
VSymbol !Symbol | A |
VString !Text | A UTF-8 encoded text |
VRegex !RE | A |
VDateTime (Maybe Day) (Maybe DiffTime) | A |
VContent (Seq Content) | A |
VArray (Vector Val) | An |
VDict (OMap Identifier Val) | A |
VTermItem (Seq Content) (Seq Content) | |
VDirection Direction | A |
VFunction (Maybe Identifier) (Map Identifier Val) Function | A Typst function. |
VArguments Arguments | Positional and named function arguments |
VLabel !Text | A |
VCounter !Counter | |
VSelector !Selector | |
VModule Identifier (Map Identifier Val) | |
VStyles | |
VVersion [Integer] | |
VBytes ByteString | |
VType !ValType |
Instances
FromJSON Val Source # | |
Defined in Typst.Types Methods parseJSON :: Value -> Parser Val parseJSONList :: Value -> Parser [Val] omittedField :: Maybe Val | |
Show Val Source # | |
Eq Val Source # | |
Ord Val Source # | |
FromValue Val Source # | |
Defined in Typst.Types | |
Compare Val Source # | |
FromVal Val Source # | |
Multipliable Val Source # | |
Defined in Typst.Types | |
Negatable Val Source # | |
Defined in Typst.Types Methods maybeNegate :: Val -> Maybe Val Source # | |
Summable Val Source # | |
A Typst type, see documentation for Val
.
Constructors
class FromVal a where Source #
Instances
FromVal Rational Source # | |
Defined in Typst.Types | |
FromVal Text Source # | |
Defined in Typst.Types | |
FromVal RE Source # | |
FromVal Counter Source # | |
FromVal Direction Source # | |
FromVal Function Source # | |
FromVal Length Source # | |
FromVal Selector Source # | |
FromVal Val Source # | |
FromVal Integer Source # | |
Defined in Typst.Types | |
FromVal String Source # | |
Defined in Typst.Types | |
FromVal Bool Source # | |
Defined in Typst.Types | |
FromVal Double Source # | |
Defined in Typst.Types | |
FromVal Int Source # | |
Defined in Typst.Types | |
FromVal (Seq Content) Source # | |
FromVal a => FromVal (Vector a) Source # | |
Defined in Typst.Types | |
FromVal a => FromVal (Maybe a) Source # | |
Defined in Typst.Types |
class Negatable a where Source #
Methods
maybeNegate :: a -> Maybe a Source #
Instances
Negatable Val Source # | |
Defined in Typst.Types Methods maybeNegate :: Val -> Maybe Val Source # |
class Multipliable a where Source #
Instances
Multipliable Val Source # | |
Defined in Typst.Types |
Constructors
Constructors
Symbol | |
Fields
|
Constructors
Txt !Text | |
Lab !Text | |
Elt | |
Fields
|
Constructors
Arguments | |
Fields
|
getPositionalArg :: (MonadFail m, MonadPlus m, FromVal a) => Int -> Arguments -> m a Source #
getNamedArg :: (MonadFail m, MonadPlus m, FromVal a) => Identifier -> Arguments -> m a Source #
Constructors
FunctionScope | |
BlockScope |
data FlowDirective Source #
Constructors
FlowNormal | |
FlowBreak | |
FlowContinue | |
FlowReturn Bool |
Instances
Show FlowDirective Source # | |
Defined in Typst.Types Methods showsPrec :: Int -> FlowDirective -> ShowS show :: FlowDirective -> String showList :: [FlowDirective] -> ShowS | |
Eq FlowDirective Source # | |
Defined in Typst.Types | |
Ord FlowDirective Source # | |
Defined in Typst.Types Methods compare :: FlowDirective -> FlowDirective -> Ordering (<) :: FlowDirective -> FlowDirective -> Bool (<=) :: FlowDirective -> FlowDirective -> Bool (>) :: FlowDirective -> FlowDirective -> Bool (>=) :: FlowDirective -> FlowDirective -> Bool max :: FlowDirective -> FlowDirective -> FlowDirective min :: FlowDirective -> FlowDirective -> FlowDirective |
data Operations (m :: Type -> Type) Source #
Constructors
Operations | |
Fields
|
data XdgDirectory #
Instances
data EvalState (m :: Type -> Type) Source #
Constructors
EvalState | |
Fields
|
emptyEvalState :: forall (m :: Type -> Type). EvalState m Source #
Constructors
CounterCustom !Text | |
CounterLabel !Text | |
CounterSelector !Selector | |
CounterPage |
renderLength :: Bool -> Length -> Text Source #
Constructors
HorizStart | |
HorizEnd | |
HorizLeft | |
HorizCenter | |
HorizRight |
Constructors
VertTop | |
VertHorizon | |
VertBottom |
Constructors
RGB Rational Rational Rational Rational | |
CMYK Rational Rational Rational Rational | |
Luma Rational |
newtype Identifier Source #
Constructors
Identifier Text |
Instances
Monoid Identifier Source # | |
Defined in Typst.Syntax Methods mempty :: Identifier mappend :: Identifier -> Identifier -> Identifier mconcat :: [Identifier] -> Identifier | |
Semigroup Identifier Source # | |
Defined in Typst.Syntax Methods (<>) :: Identifier -> Identifier -> Identifier sconcat :: NonEmpty Identifier -> Identifier stimes :: Integral b => b -> Identifier -> Identifier | |
Data Identifier Source # | |
Defined in Typst.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identifier -> c Identifier gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Identifier toConstr :: Identifier -> Constr dataTypeOf :: Identifier -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Identifier) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Identifier) gmapT :: (forall b. Data b => b -> b) -> Identifier -> Identifier gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identifier -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identifier -> r gmapQ :: (forall d. Data d => d -> u) -> Identifier -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Identifier -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identifier -> m Identifier gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identifier -> m Identifier gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identifier -> m Identifier | |
IsString Identifier Source # | |
Defined in Typst.Syntax Methods fromString :: String -> Identifier | |
Show Identifier Source # | |
Defined in Typst.Syntax Methods showsPrec :: Int -> Identifier -> ShowS show :: Identifier -> String showList :: [Identifier] -> ShowS | |
Eq Identifier Source # | |
Defined in Typst.Syntax | |
Ord Identifier Source # | |
Defined in Typst.Syntax Methods compare :: Identifier -> Identifier -> Ordering (<) :: Identifier -> Identifier -> Bool (<=) :: Identifier -> Identifier -> Bool (>) :: Identifier -> Identifier -> Bool (>=) :: Identifier -> Identifier -> Bool max :: Identifier -> Identifier -> Identifier min :: Identifier -> Identifier -> Identifier |
lookupIdentifier :: forall (m :: Type -> Type). Monad m => Identifier -> MP m Val Source #
valToContent :: Val -> Seq Content Source #
prettyType :: ValType -> Text Source #