Module

Sigil.Parse

Package
purescript-sigil
Repository
afcondon/purescript-sigil

CST → RenderType conversion.

Parses PureScript type signature strings via language-cst-parser and converts to the rendering-friendly RenderType AST.

#parseToRenderType Source

parseToRenderType :: String -> Maybe RenderType

Parse a type signature string to RenderType. Sanitizes loader artifacts (e.g. trailing comma before row variable) before parsing.

#extractCtorArgs Source

extractCtorArgs :: String -> Array String

Extract constructor argument types from a constructor signature string. Constructor sigs look like "a -> b -> MyType a b" — returns ["a", "b"] as text.

#extractCtorRenderTypes Source

extractCtorRenderTypes :: String -> Array RenderType

Extract constructor argument types as RenderType values. Constructor sigs look like "a -> b -> MyType a b" — returns [TVar "a", TVar "b"].

#elideAST Source

elideAST :: RenderType -> RenderType

Prepare AST for siglet rendering. Preserves record/row structure (with elided field types) so the siglet renderer can show { ○ ○ ○ } notation. Forall, constraints, and parens are kept. Normalizes Record (row) application to TRecord.