Copyright | Brent Yorgey |
---|---|
License | BSD-3-Clause |
Maintainer | byorgey@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Some convenient functions for putting together the whole Swarm language processing pipeline: parsing, type checking, capability checking, and elaboration. If you want to simply turn some raw text representing a Swarm program into something useful, this is probably the module you want.
Synopsis
- data ProcessedTerm = ProcessedTerm Term TModule Requirements ReqCtx
- processTerm :: Text -> Either Text (Maybe ProcessedTerm)
- processParsedTerm :: Syntax -> Either TypeErr ProcessedTerm
- processTerm' :: TCtx -> ReqCtx -> Text -> Either Text (Maybe ProcessedTerm)
- processParsedTerm' :: TCtx -> ReqCtx -> Syntax -> Either TypeErr ProcessedTerm
- showTypeErrorPos :: Text -> TypeErr -> ((Int, Int), (Int, Int), Text)
Documentation
data ProcessedTerm Source #
A record containing the results of the language processing
pipeline. Put a Term
in, and get one of these out.
ProcessedTerm | |
|
Instances
processTerm :: Text -> Either Text (Maybe ProcessedTerm) Source #
Given a Text
value representing a Swarm program,
- Parse it (see Swarm.Language.Parse)
- Typecheck it (see Swarm.Language.Typecheck)
- Elaborate it (see Swarm.Language.Elaborate)
- Check what capabilities it requires (see Swarm.Language.Capability)
Return either the end result (or Nothing
if the input was only
whitespace) or a pretty-printed error message.
processParsedTerm :: Syntax -> Either TypeErr ProcessedTerm Source #
Like processTerm
, but use a term that has already been parsed.
processTerm' :: TCtx -> ReqCtx -> Text -> Either Text (Maybe ProcessedTerm) Source #
Like processTerm
, but use explicit starting contexts.
processParsedTerm' :: TCtx -> ReqCtx -> Syntax -> Either TypeErr ProcessedTerm Source #
Like processTerm'
, but use a term that has already been parsed.