| License | BSD-3-Clause |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Swarm.Language.Capability
Description
Capabilities needed to evaluate and execute programs. Language constructs or commands require certain capabilities, and in turn capabilities are provided by various devices. A robot must have an appropriate device equipped in order to make use of each language construct or command.
Synopsis
- data Capability
- capabilityName :: Capability -> Text
- parseCapability :: Text -> Maybe Capability
- constCaps :: Const -> Maybe Capability
- constByCaps :: Map Capability (NonEmpty Const)
Documentation
data Capability Source #
Various capabilities which robots can have.
Constructors
| CExecute Const | Execute the command or function. |
| CPower | Be powered, i.e. execute anything at all |
| CMoveHeavy | Allow a heavy robot to perform movements (e.g. move, backup and stride). |
| CFloat | Don't drown in liquid. |
| COrient | Allow using absolute directions. |
| CEnv | Store and look up definitions in an environment |
| CLambda | Interpret lambda abstractions |
| CRecursion | Enable recursive definitions |
| CSum | Capability for working with sum types. |
| CProd | Capability for working with product types. |
| CRecord | Capability for working with record types. |
| CDebug | Debug capability. |
| CRectype | Capability to handle recursive types. |
| CGod | God-like capabilities. For e.g. commands intended only for checking challenge mode win conditions, and not for use by players. |
Instances
capabilityName :: Capability -> Text Source #
Get the name of the capability for use in UI and YAML.
parseCapability :: Text -> Maybe Capability Source #
Parse the capability name - inverse of capabilityName.
>>>import Data.List.Extra (enumerate)>>>all (\c -> Just c == parseCapability (capabilityName c)) enumerateTrue
constCaps :: Const -> Maybe Capability Source #
Capabilities needed to evaluate or execute a constant.
constByCaps :: Map Capability (NonEmpty Const) Source #
Inverts the constCaps mapping.