-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parsing and evaluating typst syntax. -- -- A library for parsing and evaluating typst syntax. Typst -- (https://typst.app) is a document layout and formatting -- language. This library targets typst 0.10 and currently offers only -- partial support. @package typst @version 0.6 module Typst.Syntax data Markup Space :: Markup SoftBreak :: Markup HardBreak :: Markup ParBreak :: Markup Text :: Text -> Markup Nbsp :: Markup Shy :: Markup EmDash :: Markup EnDash :: Markup Ellipsis :: Markup Quote :: Char -> Markup Ref :: Text -> Expr -> Markup Equation :: Bool -> [Markup] -> Markup Strong :: [Markup] -> Markup Emph :: [Markup] -> Markup Bracketed :: [Markup] -> Markup RawInline :: Text -> Markup RawBlock :: Text -> Text -> Markup Heading :: Int -> [Markup] -> Markup Url :: Text -> Markup BulletListItem :: [Markup] -> Markup EnumListItem :: Maybe Int -> [Markup] -> Markup DescListItem :: [Markup] -> [Markup] -> Markup Code :: SourcePos -> Expr -> Markup Comment :: Markup MAlignPoint :: Markup MFrac :: Markup -> Markup -> Markup MAttach :: Maybe Markup -> Maybe Markup -> Markup -> Markup MGroup :: Maybe Text -> Maybe Text -> [Markup] -> Markup newtype Identifier Identifier :: Text -> Identifier data Imports AllIdentifiers :: Imports SomeIdentifiers :: [(Identifier, Maybe Identifier)] -> Imports NoIdentifiers :: Maybe Identifier -> Imports data Arg KeyValArg :: Identifier -> Expr -> Arg NormalArg :: Expr -> Arg ArrayArg :: [[Markup]] -> Arg SpreadArg :: Expr -> Arg BlockArg :: [Markup] -> Arg data Param DefaultParam :: Identifier -> Expr -> Param NormalParam :: Identifier -> Param DestructuringParam :: [BindPart] -> Param SinkParam :: Maybe Identifier -> Param SkipParam :: Param data Bind BasicBind :: Maybe Identifier -> Bind DestructuringBind :: [BindPart] -> Bind data BindPart Simple :: Maybe Identifier -> BindPart WithKey :: Identifier -> Maybe Identifier -> BindPart Sink :: Maybe Identifier -> BindPart data Literal String :: Text -> Literal Boolean :: Bool -> Literal Float :: Double -> Literal Int :: Integer -> Literal Numeric :: Double -> Unit -> Literal None :: Literal Auto :: Literal data Block Content :: [Markup] -> Block CodeBlock :: [Expr] -> Block data Spreadable a Spr :: Expr -> Spreadable a Reg :: a -> Spreadable a data Expr Literal :: Literal -> Expr Negated :: Expr -> Expr ToPower :: Expr -> Expr -> Expr Times :: Expr -> Expr -> Expr Divided :: Expr -> Expr -> Expr Plus :: Expr -> Expr -> Expr Minus :: Expr -> Expr -> Expr Equals :: Expr -> Expr -> Expr LessThan :: Expr -> Expr -> Expr LessThanOrEqual :: Expr -> Expr -> Expr GreaterThan :: Expr -> Expr -> Expr GreaterThanOrEqual :: Expr -> Expr -> Expr InCollection :: Expr -> Expr -> Expr Not :: Expr -> Expr And :: Expr -> Expr -> Expr Or :: Expr -> Expr -> Expr Assign :: Expr -> Expr -> Expr Ident :: Identifier -> Expr FuncCall :: Expr -> [Arg] -> Expr FuncExpr :: [Param] -> Expr -> Expr FieldAccess :: Expr -> Expr -> Expr Group :: Expr -> Expr Array :: [Spreadable Expr] -> Expr Dict :: [Spreadable (Expr, Expr)] -> Expr Binding :: Bind -> Expr Let :: Bind -> Expr -> Expr LetFunc :: Identifier -> [Param] -> Expr -> Expr Set :: Expr -> [Arg] -> Expr Show :: Maybe Expr -> Expr -> Expr If :: [(Expr, Expr)] -> Expr While :: Expr -> Expr -> Expr For :: Bind -> Expr -> Expr -> Expr Block :: Block -> Expr Import :: Expr -> Imports -> Expr Include :: Expr -> Expr Return :: Maybe Expr -> Expr Label :: Text -> Expr Break :: Expr Continue :: Expr data Unit Pt :: Unit Mm :: Unit Cm :: Unit In :: Unit Deg :: Unit Rad :: Unit Em :: Unit Fr :: Unit Percent :: Unit instance GHC.Base.Monoid Typst.Syntax.Identifier instance GHC.Base.Semigroup Typst.Syntax.Identifier instance Data.Data.Data Typst.Syntax.Identifier instance GHC.Classes.Ord Typst.Syntax.Identifier instance GHC.Classes.Eq Typst.Syntax.Identifier instance GHC.Show.Show Typst.Syntax.Identifier instance Data.Data.Data Typst.Syntax.BindPart instance GHC.Classes.Eq Typst.Syntax.BindPart instance GHC.Classes.Ord Typst.Syntax.BindPart instance GHC.Show.Show Typst.Syntax.BindPart instance Data.Data.Data Typst.Syntax.Bind instance GHC.Classes.Eq Typst.Syntax.Bind instance GHC.Classes.Ord Typst.Syntax.Bind instance GHC.Show.Show Typst.Syntax.Bind instance Data.Data.Data Typst.Syntax.Unit instance GHC.Classes.Eq Typst.Syntax.Unit instance GHC.Classes.Ord Typst.Syntax.Unit instance GHC.Show.Show Typst.Syntax.Unit instance Data.Data.Data Typst.Syntax.Literal instance GHC.Classes.Eq Typst.Syntax.Literal instance GHC.Classes.Ord Typst.Syntax.Literal instance GHC.Show.Show Typst.Syntax.Literal instance Data.Data.Data Typst.Syntax.Imports instance GHC.Classes.Eq Typst.Syntax.Imports instance GHC.Classes.Ord Typst.Syntax.Imports instance GHC.Show.Show Typst.Syntax.Imports instance Data.Data.Data Typst.Syntax.Arg instance GHC.Classes.Eq Typst.Syntax.Arg instance GHC.Classes.Ord Typst.Syntax.Arg instance GHC.Show.Show Typst.Syntax.Arg instance Data.Data.Data Typst.Syntax.Param instance GHC.Classes.Eq Typst.Syntax.Param instance GHC.Classes.Ord Typst.Syntax.Param instance GHC.Show.Show Typst.Syntax.Param instance Data.Data.Data Typst.Syntax.Markup instance GHC.Classes.Eq Typst.Syntax.Markup instance GHC.Classes.Ord Typst.Syntax.Markup instance GHC.Show.Show Typst.Syntax.Markup instance Data.Data.Data Typst.Syntax.Block instance GHC.Classes.Eq Typst.Syntax.Block instance GHC.Classes.Ord Typst.Syntax.Block instance GHC.Show.Show Typst.Syntax.Block instance Data.Data.Data a => Data.Data.Data (Typst.Syntax.Spreadable a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Typst.Syntax.Spreadable a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Typst.Syntax.Spreadable a) instance GHC.Show.Show a => GHC.Show.Show (Typst.Syntax.Spreadable a) instance Data.Data.Data Typst.Syntax.Expr instance GHC.Classes.Eq Typst.Syntax.Expr instance GHC.Classes.Ord Typst.Syntax.Expr instance GHC.Show.Show Typst.Syntax.Expr instance Data.String.IsString Typst.Syntax.Identifier module Typst.Parse -- | Parse text into a list of Markup (or a Parsec -- ParseError). parseTypst :: FilePath -> Text -> Either ParseError [Markup] instance GHC.Show.Show Typst.Parse.PState module Typst.Types -- | A regular expression. Note that typst-hs does not use the same Regex -- engine as Typst. See issue #28. data RE -- | 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. data Val -- | The none value, indicates the absence of any other value. VNone :: Val -- | The auto value, used to automatically set an appropriate -- value. VAuto :: Val -- | A bool value. VBoolean :: !Bool -> Val -- | An int value. VInteger :: !Integer -> Val -- | A float value. VFloat :: !Double -> Val -- | A ratio value, a proportion of a certain whole, for example -- 50%. VRatio :: !Rational -> Val -- | A length or a relative value. VLength :: !Length -> Val -- | An alignment value, indicating the alignment of some content -- along both the horizontal and vertical axes. VAlignment :: Maybe Horiz -> Maybe Vert -> Val -- | An angle value (expressed internally in degrees). VAngle :: !Double -> Val -- | A fraction value, defining the proportions of remaing space -- is to be distributed, e.g. 2 fr. VFraction :: !Double -> Val -- | A color value. Not all Typst color spaces are supported; only -- rgb, cmyk, and luma are available. See -- issue #35. VColor :: !Color -> Val -- | A symbol value, representing a Unicode symbol. VSymbol :: !Symbol -> Val -- | A UTF-8 encoded text string. VString :: !Text -> Val -- | A regex (regular expression). See RE for details. VRegex :: !RE -> Val -- | A datetime value, a date, a time, or a combination of both. VDateTime :: Maybe Day -> Maybe DiffTime -> Val -- | A content value, see Content for more details. VContent :: Seq Content -> Val -- | An array value, for example (10, 20, 30). VArray :: Vector Val -> Val -- | A dictionary value, for example (a:20, b:30). VDict :: OMap Identifier Val -> Val VTermItem :: Seq Content -> Seq Content -> Val -- | A direction to lay out content. VDirection :: Direction -> Val -- | A Typst function. VFunction :: Maybe Identifier -> Map Identifier Val -> Function -> Val -- | Positional and named function arguments VArguments :: Arguments -> Val -- | A label to some element, for example hello. VLabel :: !Text -> Val VCounter :: !Counter -> Val VSelector :: !Selector -> Val VModule :: Identifier -> Map Identifier Val -> Val VStyles :: Val VVersion :: [Integer] -> Val VType :: !ValType -> Val -- | A Typst type, see documentation for Val. data ValType TNone :: ValType TAuto :: ValType TBoolean :: ValType TInteger :: ValType TFloat :: ValType TRatio :: ValType TLength :: ValType TAlignment :: ValType TAngle :: ValType TFraction :: ValType TColor :: ValType TSymbol :: ValType TString :: ValType TRegex :: ValType TDateTime :: ValType TContent :: ValType TArray :: ValType TDict :: ValType TTermItem :: ValType TDirection :: ValType TFunction :: ValType TArguments :: ValType TModule :: ValType TSelector :: ValType TStyles :: ValType TLabel :: ValType TCounter :: ValType TLocation :: ValType TVersion :: ValType TType :: ValType TAny :: ValType (:|:) :: ValType -> ValType -> ValType valType :: Val -> ValType hasType :: ValType -> Val -> Bool class FromVal a fromVal :: (FromVal a, MonadPlus m, MonadFail m) => Val -> m a class Negatable a maybeNegate :: Negatable a => a -> Maybe a class Negatable a => Summable a maybePlus :: Summable a => a -> a -> Maybe a maybeMinus :: Summable a => a -> a -> Maybe a class Multipliable a maybeTimes :: Multipliable a => a -> a -> Maybe a maybeDividedBy :: Multipliable a => a -> a -> Maybe a data Selector SelectElement :: Identifier -> [(Identifier, Val)] -> Selector SelectString :: !Text -> Selector SelectRegex :: !RE -> Selector SelectLabel :: !Text -> Selector SelectOr :: Selector -> Selector -> Selector SelectAnd :: Selector -> Selector -> Selector SelectBefore :: Selector -> Selector -> Selector SelectAfter :: Selector -> Selector -> Selector data Symbol Symbol :: !Text -> !Bool -> [(Set Text, Text)] -> Symbol [symDefault] :: Symbol -> !Text [symAccent] :: Symbol -> !Bool [symVariants] :: Symbol -> [(Set Text, Text)] data Content Txt :: !Text -> Content Lab :: !Text -> Content Elt :: Identifier -> Maybe SourcePos -> Map Identifier Val -> Content [eltName] :: Content -> Identifier [eltPos] :: Content -> Maybe SourcePos [eltFields] :: Content -> Map Identifier Val newtype Function Function :: (forall m. Monad m => Arguments -> MP m Val) -> Function data Arguments Arguments :: [Val] -> OMap Identifier Val -> Arguments [positional] :: Arguments -> [Val] [named] :: Arguments -> 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 comp :: Compare a => a -> a -> Maybe Ordering type MP m = ParsecT [Markup] (EvalState m) m data Scope FunctionScope :: Scope BlockScope :: Scope data FlowDirective FlowNormal :: FlowDirective FlowBreak :: FlowDirective FlowContinue :: FlowDirective FlowReturn :: Bool -> FlowDirective data Operations m Operations :: (FilePath -> m ByteString) -> m UTCTime -> (String -> m (Maybe String)) -> (FilePath -> m Bool) -> Operations m [loadBytes] :: Operations m -> FilePath -> m ByteString [currentUTCTime] :: Operations m -> m UTCTime [lookupEnvVar] :: Operations m -> String -> m (Maybe String) [checkExistence] :: Operations m -> FilePath -> m Bool -- | Special directories for storing user-specific application data, -- configuration, and cache files, as specified by the XDG Base -- Directory Specification. -- -- Note: On Windows, XdgData and XdgConfig usually map to -- the same directory. data () => XdgDirectory -- | For data files (e.g. images). It uses the XDG_DATA_HOME -- environment variable. On non-Windows systems, the default is -- ~/.local/share. On Windows, the default is %APPDATA% -- (e.g. C:/Users/<user>/AppData/Roaming). Can be -- considered as the user-specific equivalent of /usr/share. XdgData :: XdgDirectory -- | For configuration files. It uses the XDG_CONFIG_HOME -- environment variable. On non-Windows systems, the default is -- ~/.config. On Windows, the default is %APPDATA% -- (e.g. C:/Users/<user>/AppData/Roaming). Can be -- considered as the user-specific equivalent of /etc. XdgConfig :: XdgDirectory -- | For non-essential files (e.g. cache). It uses the -- XDG_CACHE_HOME environment variable. On non-Windows systems, -- the default is ~/.cache. On Windows, the default is -- %LOCALAPPDATA% (e.g. -- C:/Users/<user>/AppData/Local). Can be -- considered as the user-specific equivalent of /var/cache. XdgCache :: XdgDirectory -- | For data that should persist between (application) restarts, but that -- is not important or portable enough to the user that it should be -- stored in XdgData. It uses the XDG_STATE_HOME -- environment variable. On non-Windows sytems, the default is -- ~/.local/state. On Windows, the default is -- %LOCALAPPDATA% (e.g. -- C:/Users/<user>/AppData/Local). XdgState :: XdgDirectory data EvalState m EvalState :: [(Scope, Map Identifier Val)] -> [(Scope, Map Identifier Val)] -> [(Scope, Map Identifier Val)] -> Map Counter Integer -> Bool -> [ShowRule] -> Map Identifier Arguments -> FlowDirective -> FilePath -> Operations m -> EvalState m [evalIdentifiers] :: EvalState m -> [(Scope, Map Identifier Val)] [evalStandardIdentifiers] :: EvalState m -> [(Scope, Map Identifier Val)] [evalMathIdentifiers] :: EvalState m -> [(Scope, Map Identifier Val)] [evalCounters] :: EvalState m -> Map Counter Integer [evalMath] :: EvalState m -> Bool [evalShowRules] :: EvalState m -> [ShowRule] [evalStyles] :: EvalState m -> Map Identifier Arguments [evalFlowDirective] :: EvalState m -> FlowDirective [evalPackageRoot] :: EvalState m -> FilePath [evalOperations] :: EvalState m -> Operations m emptyEvalState :: EvalState m data ShowRule ShowRule :: Selector -> (forall m. Monad m => Content -> MP m (Seq Content)) -> ShowRule data Counter CounterCustom :: !Text -> Counter CounterLabel :: !Text -> Counter CounterSelector :: !Selector -> Counter CounterPage :: Counter data LUnit LEm :: LUnit LPt :: LUnit LIn :: LUnit LCm :: LUnit LMm :: LUnit data Length LExact :: Double -> LUnit -> Length LRatio :: !Rational -> Length LSum :: Length -> Length -> Length renderLength :: Bool -> Length -> Text data Horiz HorizStart :: Horiz HorizEnd :: Horiz HorizLeft :: Horiz HorizCenter :: Horiz HorizRight :: Horiz data Vert VertTop :: Vert VertHorizon :: Vert VertBottom :: Vert data Color RGB :: Rational -> Rational -> Rational -> Rational -> Color CMYK :: Rational -> Rational -> Rational -> Rational -> Color Luma :: Rational -> Color data Direction -- | Left to right Ltr :: Direction -- | Right to left Rtl :: Direction -- | Top to bottom Ttb :: Direction -- | Bottom to top Btt :: Direction newtype Identifier Identifier :: Text -> Identifier lookupIdentifier :: 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 Success :: a -> Attempt a Failure :: String -> Attempt a instance GHC.Classes.Ord Typst.Types.ValType instance GHC.Classes.Eq Typst.Types.ValType instance GHC.Show.Show Typst.Types.ValType instance GHC.Classes.Eq Typst.Types.Symbol instance GHC.Show.Show Typst.Types.Symbol instance GHC.Classes.Eq Typst.Types.Scope instance GHC.Classes.Ord Typst.Types.Scope instance GHC.Show.Show Typst.Types.Scope instance GHC.Classes.Eq Typst.Types.FlowDirective instance GHC.Classes.Ord Typst.Types.FlowDirective instance GHC.Show.Show Typst.Types.FlowDirective instance GHC.Classes.Ord a => GHC.Classes.Ord (Typst.Types.Attempt a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Typst.Types.Attempt a) instance GHC.Show.Show a => GHC.Show.Show (Typst.Types.Attempt a) instance GHC.Classes.Eq Typst.Types.LUnit instance GHC.Show.Show Typst.Types.LUnit instance GHC.Classes.Eq Typst.Types.Length instance GHC.Show.Show Typst.Types.Length instance GHC.Classes.Ord Typst.Types.Horiz instance GHC.Classes.Eq Typst.Types.Horiz instance GHC.Show.Show Typst.Types.Horiz instance GHC.Classes.Ord Typst.Types.Vert instance GHC.Classes.Eq Typst.Types.Vert instance GHC.Show.Show Typst.Types.Vert instance GHC.Classes.Ord Typst.Types.Color instance GHC.Classes.Eq Typst.Types.Color instance GHC.Show.Show Typst.Types.Color instance GHC.Classes.Ord Typst.Types.Direction instance GHC.Classes.Eq Typst.Types.Direction instance GHC.Show.Show Typst.Types.Direction instance GHC.Show.Show Typst.Types.Content instance GHC.Classes.Eq Typst.Types.Arguments instance GHC.Show.Show Typst.Types.Arguments instance GHC.Classes.Ord Typst.Types.Selector instance GHC.Classes.Eq Typst.Types.Selector instance GHC.Show.Show Typst.Types.Selector instance GHC.Show.Show Typst.Types.Counter instance GHC.Classes.Ord Typst.Types.Counter instance GHC.Classes.Eq Typst.Types.Counter instance GHC.Classes.Eq Typst.Types.Val instance GHC.Show.Show Typst.Types.Val instance Typst.Types.FromVal Typst.Types.Val instance Typst.Types.FromVal (Data.Sequence.Internal.Seq Typst.Types.Content) instance Typst.Types.FromVal Data.Text.Internal.Text instance Typst.Types.FromVal GHC.Base.String instance Typst.Types.FromVal Typst.Regex.RE instance Typst.Types.FromVal GHC.Num.Integer.Integer instance Typst.Types.FromVal GHC.Types.Int instance Typst.Types.FromVal GHC.Real.Rational instance Typst.Types.FromVal GHC.Types.Double instance Typst.Types.FromVal GHC.Types.Bool instance Typst.Types.FromVal Typst.Types.Length instance Typst.Types.FromVal Typst.Types.Function instance Typst.Types.FromVal Typst.Types.Direction instance Typst.Types.FromVal Typst.Types.Counter instance Typst.Types.FromVal Typst.Types.Selector instance Typst.Types.FromVal a => Typst.Types.FromVal (GHC.Maybe.Maybe a) instance Typst.Types.FromVal a => Typst.Types.FromVal (Data.Vector.Vector a) instance Data.Aeson.Types.FromJSON.FromJSON Typst.Types.Val instance Toml.Schema.FromValue.FromValue Typst.Types.Val instance Typst.Types.Compare Typst.Types.Val instance GHC.Classes.Ord Typst.Types.Val instance Typst.Types.Negatable Typst.Types.Val instance Typst.Types.Summable Typst.Types.Val instance Typst.Types.Multipliable Typst.Types.Val instance GHC.Classes.Eq Typst.Types.Content instance GHC.Classes.Ord Typst.Types.Content instance Data.String.IsString Typst.Types.Content instance GHC.Show.Show Typst.Types.Function instance GHC.Classes.Eq Typst.Types.Function instance GHC.Show.Show Typst.Types.ShowRule instance GHC.Base.Semigroup Typst.Types.Arguments instance GHC.Base.Monoid Typst.Types.Arguments instance GHC.Base.Semigroup Typst.Types.Length instance GHC.Base.Monoid Typst.Types.Length instance GHC.Base.Functor Typst.Types.Attempt instance GHC.Base.Applicative Typst.Types.Attempt instance GHC.Base.Monad Typst.Types.Attempt instance Control.Monad.Fail.MonadFail Typst.Types.Attempt module Typst.Util data TypeSpec One :: ValType -> TypeSpec Many :: ValType -> TypeSpec -- | Create element function with names for positional parameters. makeElement :: Maybe Identifier -> Identifier -> [(Identifier, TypeSpec)] -> (Identifier, Val) -- | Create element function with names for positional parameters. makeElementWithScope :: Maybe Identifier -> Identifier -> [(Identifier, TypeSpec)] -> Map Identifier Val -> (Identifier, Val) makeFunction :: (forall m'. Monad m' => ReaderT Arguments (MP m') Val) -> Val makeFunctionWithScope :: (forall m'. Monad m' => ReaderT Arguments (MP m') Val) -> Map Identifier Val -> Val makeSymbolMap :: [(Text, Bool, Text)] -> Map Identifier Symbol argsToFields :: MonadFail m => [(Identifier, TypeSpec)] -> Arguments -> m (Map Identifier Val) nthArg :: (Monad m, FromVal a) => Int -> ReaderT Arguments (MP m) a namedArg :: (Monad m, FromVal a) => Identifier -> a -> ReaderT Arguments (MP m) a allArgs :: Monad m => ReaderT Arguments (MP m) [Val] instance GHC.Classes.Eq Typst.Util.TypeSpec instance GHC.Show.Show Typst.Util.TypeSpec module Typst.Methods getMethod :: MonadFail m => (forall n. Monad n => Val -> MP n ()) -> Val -> Text -> m Val formatNumber :: Text -> Int -> Text applyPureFunction :: Function -> [Val] -> Attempt Val instance GHC.Show.Show Typst.Methods.FormatPart module Typst.Evaluate -- | Evaluate a parsed typst expression, evaluating the code and replacing -- it with content. evaluateTypst :: Monad m => Operations m -> FilePath -> [Markup] -> m (Either ParseError Content) valToContent :: Val -> Seq Content instance GHC.Generics.Generic Typst.Evaluate.PackageConfig instance GHC.Show.Show Typst.Evaluate.PackageConfig instance GHC.Generics.Generic Typst.Evaluate.Config instance GHC.Show.Show Typst.Evaluate.Config instance Toml.Schema.FromValue.FromValue Typst.Evaluate.Config instance Toml.Schema.FromValue.FromValue Typst.Evaluate.PackageConfig module Typst