Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- binding :: forall m v. (Monad m, Var v) => P v m ((Ann, v), Term v Ann)
- blockTerm :: (Monad m, Var v) => TermP v m
- doc2Block :: forall m v. (Monad m, Var v) => P v m (Ann, Term v Ann)
- imports :: (Monad m, Var v) => P v m (Names, [(v, v)])
- lam :: Var v => TermP v m -> TermP v m
- substImports :: Var v => Names -> [(v, v)] -> Term v Ann -> Term v Ann
- term :: (Monad m, Var v) => TermP v m
- verifyRelativeVarName :: Var v => P v m (Token v) -> P v m (Token v)
Documentation
binding :: forall m v. (Monad m, Var v) => P v m ((Ann, v), Term v Ann) Source #
Rules for the annotation of the resulting binding is as follows: * If the binding has a type signature, the top level scope of the annotation for the type Ann node will contain the _entire_ binding, including the type signature. * The body expression of the binding contains the entire lhs (including the name of the binding) and the entire body. * If the binding is a lambda, the lambda node includes the entire LHS of the binding, including the name as well.
doc2Block :: forall m v. (Monad m, Var v) => P v m (Ann, Term v Ann) Source #
Syntax for documentation v2 blocks, which are surrounded by {{
}}
.
The lexer does most of the heavy lifting so there's not a lot for
the parser to do. For instance, in
{{ Hi there! goodbye. }}
the lexer will produce:
[ Doc ( DocUntitledSection (DocParagraph (DocWord "Hi" :| [DocWord "there!"])) (DocParagraph (DocWord "goodbye" :| [])) ) ]
The parser will parse this into the Unison expression:
syntax.docUntitledSection [ syntax.docParagraph [syntax.docWord "Hi", syntax.docWord "there!"], syntax.docParagraph [syntax.docWord "goodbye"] ]
Where syntax.doc{Paragraph, UntitledSection,...}
are all ordinary term
variables that will be looked up in the environment like anything else. This
means that the documentation syntax can have its meaning changed by
overriding what functions the names syntax.doc*
correspond to.