swarm-0.7.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellNone
LanguageHaskell2010

Swarm.Language.Pipeline

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

Pipeline functions

processTerm :: Text -> Either Text (Maybe TSyntax) Source #

Given a Text value representing a Swarm program,

  1. Parse it (see Swarm.Language.Parse)
  2. Typecheck it (see Swarm.Language.Typecheck)
  3. 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.