License | BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Swarm.Language.Pipeline
Contents
Description
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
- processTerm :: Text -> Either Text (Maybe TSyntax)
- processParsedTerm :: Syntax -> Either ContextualTypeErr TSyntax
- processTerm' :: Env -> Text -> Either Text (Maybe TSyntax)
- processParsedTerm' :: Env -> Syntax -> Either ContextualTypeErr TSyntax
- processTermEither :: Text -> Either Text TSyntax
- extractTCtx :: Syntax' ty -> TCtx
- extractReqCtx :: Syntax' ty -> ReqCtx
Pipeline functions
processTerm :: Text -> Either Text (Maybe TSyntax) 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)
Return either the end result (or Nothing
if the input was only
whitespace) or a pretty-printed error message.
processParsedTerm :: Syntax -> Either ContextualTypeErr TSyntax Source #
Like processTerm
, but use a term that has already been parsed.
processTerm' :: Env -> Text -> Either Text (Maybe TSyntax) Source #
Like processTerm
, but use explicit starting contexts.
processParsedTerm' :: Env -> Syntax -> Either ContextualTypeErr TSyntax Source #
Like processTerm'
, but use a term that has already been parsed.
Utilities
extractTCtx :: Syntax' ty -> TCtx Source #
Extract a type context from type annotations on definitions contained in a term. Should probably only be used for testing.
extractReqCtx :: Syntax' ty -> ReqCtx Source #
Extract a requirements context from requirements annotations on definitions contained in a term. Should probably only be used for testing.