-- 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.4 and currently offers only
--   partial support.
@package typst
@version 0.1.0.0

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] -> Imports
NoIdentifiers :: 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 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 :: [Expr] -> Expr
Dict :: [(Identifier, 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 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
parseTypst :: FilePath -> Text -> Either ParseError [Markup]
instance GHC.Show.Show Typst.Parse.PState

module Typst.Types
data RE
data Val
VNone :: Val
VAuto :: Val
VBoolean :: !Bool -> Val
VInteger :: !Integer -> Val
VFloat :: !Double -> Val
VRatio :: !Rational -> Val
VLength :: !Length -> Val
VAlignment :: Maybe Horiz -> Maybe Vert -> Val
VAngle :: !Double -> Val
VFraction :: !Double -> Val
VColor :: !Color -> Val
VSymbol :: !Symbol -> Val
VString :: !Text -> Val
VRegex :: !RE -> Val
VContent :: Seq Content -> Val
VArray :: Vector Val -> Val
VDict :: OMap Identifier Val -> Val
VTermItem :: Seq Content -> Seq Content -> Val
VDirection :: Direction -> Val
VFunction :: Maybe Identifier -> Map Identifier Val -> Function -> Val
VArguments :: Arguments -> Val
VLabel :: !Text -> Val
VCounter :: !Counter -> Val
VSelector :: !Selector -> Val
VModule :: Identifier -> Map Identifier Val -> Val
VStyles :: 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
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
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 EvalState m
EvalState :: [(Scope, Map Identifier Val)] -> Map Counter Integer -> Bool -> [ShowRule] -> Map Identifier Arguments -> FlowDirective -> (FilePath -> m ByteString) -> EvalState m
[evalIdentifiers] :: 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
[evalLoadBytes] :: EvalState m -> FilePath -> m ByteString
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
Ltr :: Direction
Rtl :: Direction
Ttb :: Direction
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
repr :: Val -> Text
data Attempt a
Success :: a -> Attempt a
Failure :: String -> Attempt a
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 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 -> 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
applyPureFunction :: Function -> [Val] -> Attempt Val
formatNumber :: Text -> Int -> Text

module Typst.Evaluate

-- | Evaluate a parsed typst expression, evaluating the code and replacing
--   it with content.
evaluateTypst :: Monad m => (FilePath -> m ByteString) -> FilePath -> [Markup] -> m (Either ParseError (Seq Content))
valToContent :: Val -> Seq Content

module Typst
