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

Swarm.Language.Syntax.AST

Description

Types representing the surface syntax and terms for Swarm programming language.

Synopsis

Documentation

data Syntax' ty Source #

The surface syntax for the language, with location and type annotations.

Constructors

Syntax' 

Fields

Instances

Instances details
FromJSON Syntax Source # 
Instance details

Defined in Swarm.Language.JSON

FromJSON TSyntax Source # 
Instance details

Defined in Swarm.Language.JSON

ToJSON Syntax Source # 
Instance details

Defined in Swarm.Language.JSON

ToJSON TSyntax Source # 
Instance details

Defined in Swarm.Language.JSON

Foldable Syntax' Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

fold :: Monoid m => Syntax' m -> m #

foldMap :: Monoid m => (a -> m) -> Syntax' a -> m #

foldMap' :: Monoid m => (a -> m) -> Syntax' a -> m #

foldr :: (a -> b -> b) -> b -> Syntax' a -> b #

foldr' :: (a -> b -> b) -> b -> Syntax' a -> b #

foldl :: (b -> a -> b) -> b -> Syntax' a -> b #

foldl' :: (b -> a -> b) -> b -> Syntax' a -> b #

foldr1 :: (a -> a -> a) -> Syntax' a -> a #

foldl1 :: (a -> a -> a) -> Syntax' a -> a #

toList :: Syntax' a -> [a] #

null :: Syntax' a -> Bool #

length :: Syntax' a -> Int #

elem :: Eq a => a -> Syntax' a -> Bool #

maximum :: Ord a => Syntax' a -> a #

minimum :: Ord a => Syntax' a -> a #

sum :: Num a => Syntax' a -> a #

product :: Num a => Syntax' a -> a #

Traversable Syntax' Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

traverse :: Applicative f => (a -> f b) -> Syntax' a -> f (Syntax' b) #

sequenceA :: Applicative f => Syntax' (f a) -> f (Syntax' a) #

mapM :: Monad m => (a -> m b) -> Syntax' a -> m (Syntax' b) #

sequence :: Monad m => Syntax' (m a) -> m (Syntax' a) #

Functor Syntax' Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

fmap :: (a -> b) -> Syntax' a -> Syntax' b #

(<$) :: a -> Syntax' b -> Syntax' a #

FromJSON (Document Syntax) Source # 
Instance details

Defined in Swarm.Language.Text.Markdown

ToJSON (Document Syntax) Source # 
Instance details

Defined in Swarm.Language.Text.Markdown

ToJSON (Paragraph Syntax) Source # 
Instance details

Defined in Swarm.Language.Text.Markdown

Data ty => Data (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Syntax' ty -> c (Syntax' ty) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Syntax' ty) #

toConstr :: Syntax' ty -> Constr #

dataTypeOf :: Syntax' ty -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Syntax' ty)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Syntax' ty)) #

gmapT :: (forall b. Data b => b -> b) -> Syntax' ty -> Syntax' ty #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Syntax' ty -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Syntax' ty -> r #

gmapQ :: (forall d. Data d => d -> u) -> Syntax' ty -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Syntax' ty -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Syntax' ty -> m (Syntax' ty) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Syntax' ty -> m (Syntax' ty) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Syntax' ty -> m (Syntax' ty) #

IsString (Document Syntax) Source # 
Instance details

Defined in Swarm.Language.Text.Markdown

IsString (Paragraph Syntax) Source # 
Instance details

Defined in Swarm.Language.Text.Markdown

Generic (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Associated Types

type Rep (Syntax' ty) 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep (Syntax' ty) = D1 ('MetaData "Syntax'" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Syntax'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_sLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "_sTerm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Term' ty))) :*: (S1 ('MetaSel ('Just "_sComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Comments) :*: S1 ('MetaSel ('Just "_sType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ty))))

Methods

from :: Syntax' ty -> Rep (Syntax' ty) x #

to :: Rep (Syntax' ty) x -> Syntax' ty #

Show ty => Show (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

showsPrec :: Int -> Syntax' ty -> ShowS #

show :: Syntax' ty -> String #

showList :: [Syntax' ty] -> ShowS #

Eq ty => Eq (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

(==) :: Syntax' ty -> Syntax' ty -> Bool #

(/=) :: Syntax' ty -> Syntax' ty -> Bool #

Hashable ty => Hashable (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

hashWithSalt :: Int -> Syntax' ty -> Int #

hash :: Syntax' ty -> Int #

Data ty => Plated (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

plate :: Traversal' (Syntax' ty) (Syntax' ty) #

PrettyPrec (Syntax' ty)

Pretty-print a syntax node with comments.

Instance details

Defined in Swarm.Language.Syntax.Pretty

Methods

prettyPrec :: Int -> Syntax' ty -> Doc ann

type Rep (Syntax' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep (Syntax' ty) = D1 ('MetaData "Syntax'" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Syntax'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_sLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "_sTerm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Term' ty))) :*: (S1 ('MetaSel ('Just "_sComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Comments) :*: S1 ('MetaSel ('Just "_sType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ty))))

data LetSyntax Source #

A let expression can be written either as let x = e1 in e2 or as def x = e1 end; e2. This enumeration simply records which it was so that we can pretty-print appropriately.

Constructors

LSLet 
LSDef 

Instances

Instances details
FromJSON LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

ToJSON LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Data LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LetSyntax -> c LetSyntax #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LetSyntax #

toConstr :: LetSyntax -> Constr #

dataTypeOf :: LetSyntax -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LetSyntax) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LetSyntax) #

gmapT :: (forall b. Data b => b -> b) -> LetSyntax -> LetSyntax #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LetSyntax -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LetSyntax -> r #

gmapQ :: (forall d. Data d => d -> u) -> LetSyntax -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LetSyntax -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LetSyntax -> m LetSyntax #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LetSyntax -> m LetSyntax #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LetSyntax -> m LetSyntax #

Bounded LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Enum LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Generic LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Associated Types

type Rep LetSyntax 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep LetSyntax = D1 ('MetaData "LetSyntax" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LSLet" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LSDef" 'PrefixI 'False) (U1 :: Type -> Type))
Show LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Eq LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Ord LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Hashable LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep LetSyntax Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep LetSyntax = D1 ('MetaData "LetSyntax" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LSLet" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LSDef" 'PrefixI 'False) (U1 :: Type -> Type))

data Term' ty Source #

Terms of the Swarm language.

Constructors

TUnit

The unit value.

TConst Const

A constant.

TDir Direction

A direction literal.

TInt Integer

An integer literal.

TAntiInt Text

An antiquoted Haskell variable name of type Integer.

TText Text

A text literal.

TAntiText Text

An antiquoted Haskell variable name of type Text.

TBool Bool

A Boolean literal.

TAntiSyn Text

An antiquoted Haskell variable name of type Syntax.

TRobot Int

A robot reference. These never show up in surface syntax, but are here so we can factor pretty-printing for Values through pretty-printing for Terms.

TRef Int

A memory reference. These likewise never show up in surface syntax, but are here to facilitate pretty-printing.

TRequire Text

Require a specific device to be installed.

TStock Int Text

Require a certain number of an entity.

SRequirements Text (Syntax' ty)

Primitive command to log requirements of a term. The Text field is to store the unaltered original text of the term, for use in displaying the log message (since once we get to execution time the original term may have been elaborated, e.g. force may have been added around some variables, etc.)

TVar Var

A variable.

SPair (Syntax' ty) (Syntax' ty)

A pair.

SLam LocVar (Maybe Type) (Syntax' ty)

A lambda expression, with or without a type annotation on the binder.

SApp (Syntax' ty) (Syntax' ty)

Function application.

SLet LetSyntax Bool LocVar (Maybe RawPolytype) (Maybe Polytype) (Maybe Requirements) (Syntax' ty) (Syntax' ty)

A (recursive) let/def expression, with or without a type annotation on the variable. The Bool indicates whether it is known to be recursive.

The Maybe Polytype and Maybe Requirements fields are only for annotating the requirements of a definition after typechecking; there is no way to annotate requirements in the surface syntax.

STydef (Located TDVar) Polytype (Maybe TydefInfo) (Syntax' ty)

A type synonym definition. Note that this acts like a let (just like def), i.e. the Syntax' ty field is the local context over which the type definition is in scope.

SBind (Maybe LocVar) (Maybe ty) (Maybe Polytype) (Maybe Requirements) (Syntax' ty) (Syntax' ty)

A monadic bind for commands, of the form c1 ; c2 or x <- c1; c2.

The Maybe ty field is a place to stash the inferred type of the variable (if any) during type inference. Once type inference is complete, during elaboration we will copy the inferred type into the Maybe Polytype field (since the Maybe ty field will be erased).

The Maybe Polytype and Maybe Requirements fields is only for annotating the type of a bind after typechecking; there is no surface syntax that allows directly annotating a bind with either one.

SDelay (Syntax' ty)

Delay evaluation of a term, written {...}. Swarm is an eager language, but in some cases (e.g. for if statements and recursive bindings) we need to delay evaluation. The counterpart to {...} is force, where force {t} = t. Note that Force is just a constant, whereas SDelay has to be a special syntactic form so its argument can get special treatment during evaluation.

SRcd (Map Var (Maybe (Syntax' ty)))

Record literals [x1 = e1, x2 = e2, x3, ...] Names x without an accompanying definition are sugar for writing x=x.

SProj (Syntax' ty) Var

Record projection e.x

SAnnotate (Syntax' ty) RawPolytype

Annotate a term with a type

SSuspend (Syntax' ty)

Run the given command, then suspend and wait for a new REPL input.

SParens (Syntax' ty)

An explicit representation of parentheses in the input. We need this to be able to print formatted code with parentheses and comments preserved, but we get rid of them during elaboration.

TType Type

A type literal.

Instances

Instances details
FromJSON Term Source # 
Instance details

Defined in Swarm.Language.JSON

ToJSON Term Source # 
Instance details

Defined in Swarm.Language.JSON

Foldable Term' Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

fold :: Monoid m => Term' m -> m #

foldMap :: Monoid m => (a -> m) -> Term' a -> m #

foldMap' :: Monoid m => (a -> m) -> Term' a -> m #

foldr :: (a -> b -> b) -> b -> Term' a -> b #

foldr' :: (a -> b -> b) -> b -> Term' a -> b #

foldl :: (b -> a -> b) -> b -> Term' a -> b #

foldl' :: (b -> a -> b) -> b -> Term' a -> b #

foldr1 :: (a -> a -> a) -> Term' a -> a #

foldl1 :: (a -> a -> a) -> Term' a -> a #

toList :: Term' a -> [a] #

null :: Term' a -> Bool #

length :: Term' a -> Int #

elem :: Eq a => a -> Term' a -> Bool #

maximum :: Ord a => Term' a -> a #

minimum :: Ord a => Term' a -> a #

sum :: Num a => Term' a -> a #

product :: Num a => Term' a -> a #

Traversable Term' Source #

The Traversable instance for Term (and for Syntax') is used during typechecking: during intermediate type inference, many of the type annotations placed on AST nodes will have unification variables in them. Once we have finished solving everything we need to do a final traversal over all the types in the AST to substitute away all the unification variables (and generalize, i.e. stick forall on, as appropriate). See the call to mapM in Swarm.Language.Typecheck.runInfer.

Instance details

Defined in Swarm.Language.Syntax.AST

Methods

traverse :: Applicative f => (a -> f b) -> Term' a -> f (Term' b) #

sequenceA :: Applicative f => Term' (f a) -> f (Term' a) #

mapM :: Monad m => (a -> m b) -> Term' a -> m (Term' b) #

sequence :: Monad m => Term' (m a) -> m (Term' a) #

Functor Term' Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

fmap :: (a -> b) -> Term' a -> Term' b #

(<$) :: a -> Term' b -> Term' a #

Data ty => Data (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Term' ty -> c (Term' ty) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Term' ty) #

toConstr :: Term' ty -> Constr #

dataTypeOf :: Term' ty -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Term' ty)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Term' ty)) #

gmapT :: (forall b. Data b => b -> b) -> Term' ty -> Term' ty #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Term' ty -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Term' ty -> r #

gmapQ :: (forall d. Data d => d -> u) -> Term' ty -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Term' ty -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Term' ty -> m (Term' ty) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Term' ty -> m (Term' ty) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Term' ty -> m (Term' ty) #

Generic (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Associated Types

type Rep (Term' ty) 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep (Term' ty) = D1 ('MetaData "Term'" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) ((((C1 ('MetaCons "TUnit" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TConst" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Const)) :+: C1 ('MetaCons "TDir" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Direction)))) :+: ((C1 ('MetaCons "TInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "TAntiInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :+: (C1 ('MetaCons "TText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "TAntiText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))) :+: ((C1 ('MetaCons "TBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :+: (C1 ('MetaCons "TAntiSyn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "TRobot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :+: ((C1 ('MetaCons "TRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :+: C1 ('MetaCons "TRequire" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :+: (C1 ('MetaCons "TStock" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "SRequirements" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))))))) :+: (((C1 ('MetaCons "TVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Var)) :+: (C1 ('MetaCons "SPair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "SLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LocVar) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Type)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))) :+: ((C1 ('MetaCons "SApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "SLet" 'PrefixI 'False) (((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LetSyntax) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LocVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RawPolytype)))) :*: ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Polytype)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Requirements))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))) :+: (C1 ('MetaCons "STydef" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Located TDVar)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Polytype)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe TydefInfo)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))) :+: C1 ('MetaCons "SBind" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe LocVar)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Polytype)))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Requirements)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))))) :+: ((C1 ('MetaCons "SDelay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: (C1 ('MetaCons "SRcd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map Var (Maybe (Syntax' ty))))) :+: C1 ('MetaCons "SProj" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Var)))) :+: ((C1 ('MetaCons "SAnnotate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RawPolytype)) :+: C1 ('MetaCons "SSuspend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))) :+: (C1 ('MetaCons "SParens" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "TType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Type)))))))

Methods

from :: Term' ty -> Rep (Term' ty) x #

to :: Rep (Term' ty) x -> Term' ty #

Show ty => Show (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

showsPrec :: Int -> Term' ty -> ShowS #

show :: Term' ty -> String #

showList :: [Term' ty] -> ShowS #

Eq ty => Eq (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

(==) :: Term' ty -> Term' ty -> Bool #

(/=) :: Term' ty -> Term' ty -> Bool #

Hashable ty => Hashable (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

hashWithSalt :: Int -> Term' ty -> Int #

hash :: Term' ty -> Int #

Data ty => Plated (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

Methods

plate :: Traversal' (Term' ty) (Term' ty) #

PrettyPrec (Term' ty) 
Instance details

Defined in Swarm.Language.Syntax.Pretty

Methods

prettyPrec :: Int -> Term' ty -> Doc ann

type Rep (Term' ty) Source # 
Instance details

Defined in Swarm.Language.Syntax.AST

type Rep (Term' ty) = D1 ('MetaData "Term'" "Swarm.Language.Syntax.AST" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) ((((C1 ('MetaCons "TUnit" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TConst" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Const)) :+: C1 ('MetaCons "TDir" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Direction)))) :+: ((C1 ('MetaCons "TInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "TAntiInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :+: (C1 ('MetaCons "TText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "TAntiText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))) :+: ((C1 ('MetaCons "TBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :+: (C1 ('MetaCons "TAntiSyn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "TRobot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :+: ((C1 ('MetaCons "TRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :+: C1 ('MetaCons "TRequire" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :+: (C1 ('MetaCons "TStock" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "SRequirements" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))))))) :+: (((C1 ('MetaCons "TVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Var)) :+: (C1 ('MetaCons "SPair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "SLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LocVar) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Type)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))) :+: ((C1 ('MetaCons "SApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "SLet" 'PrefixI 'False) (((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LetSyntax) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LocVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RawPolytype)))) :*: ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Polytype)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Requirements))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))) :+: (C1 ('MetaCons "STydef" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Located TDVar)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Polytype)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe TydefInfo)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))) :+: C1 ('MetaCons "SBind" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe LocVar)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Polytype)))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Requirements)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))))))) :+: ((C1 ('MetaCons "SDelay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: (C1 ('MetaCons "SRcd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map Var (Maybe (Syntax' ty))))) :+: C1 ('MetaCons "SProj" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Var)))) :+: ((C1 ('MetaCons "SAnnotate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RawPolytype)) :+: C1 ('MetaCons "SSuspend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty)))) :+: (C1 ('MetaCons "SParens" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' ty))) :+: C1 ('MetaCons "TType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Type)))))))