swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Language.Module

Contents

Description

A Module packages together a type-annotated syntax tree along with a context of top-level definitions.

Synopsis

Modules

data Module s t Source #

A module generally represents the result of performing type inference on a top-level expression, which in particular can contain definitions (TDef). A module contains the type-annotated AST of the expression itself, as well as the context giving the types of any defined variables.

Constructors

Module 

Fields

Instances

Instances details
HasBindings UModule Source # 
Instance details

Defined in Swarm.Language.Typecheck

Functor (Module s) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

fmap :: (a -> b) -> Module s a -> Module s b #

(<$) :: a -> Module s b -> Module s a #

(FromJSON s, FromJSON t) => FromJSON (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

parseJSON :: Value -> Parser (Module s t) #

parseJSONList :: Value -> Parser [Module s t] #

(ToJSON t, ToJSON s) => ToJSON (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

toJSON :: Module s t -> Value #

toEncoding :: Module s t -> Encoding #

toJSONList :: [Module s t] -> Value #

toEncodingList :: [Module s t] -> Encoding #

(Data s, Data t) => Data (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Module s t -> c (Module s t) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Module s t) #

toConstr :: Module s t -> Constr #

dataTypeOf :: Module s t -> DataType #

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

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

gmapT :: (forall b. Data b => b -> b) -> Module s t -> Module s t #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Module s t -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Module s t -> r #

gmapQ :: (forall d. Data d => d -> u) -> Module s t -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Module s t -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Module s t -> m (Module s t) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Module s t -> m (Module s t) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Module s t -> m (Module s t) #

Generic (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Associated Types

type Rep (Module s t) :: Type -> Type #

Methods

from :: Module s t -> Rep (Module s t) x #

to :: Rep (Module s t) x -> Module s t #

(Show s, Show t) => Show (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

showsPrec :: Int -> Module s t -> ShowS #

show :: Module s t -> String #

showList :: [Module s t] -> ShowS #

(Eq s, Eq t) => Eq (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

Methods

(==) :: Module s t -> Module s t -> Bool #

(/=) :: Module s t -> Module s t -> Bool #

type Rep (Module s t) Source # 
Instance details

Defined in Swarm.Language.Module

type Rep (Module s t) = D1 ('MetaData "Module" "Swarm.Language.Module" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "Module" 'PrefixI 'True) (S1 ('MetaSel ('Just "moduleAST") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Syntax' s)) :*: S1 ('MetaSel ('Just "moduleCtx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Ctx t))))

type TModule = Module Polytype Polytype Source #

A TModule is the final result of the type inference process on an expression: we get a polytype for the expression, and a context of polytypes for the defined variables.

type UModule = Module UType UPolytype Source #

A UModule represents the type of an expression at some intermediate stage during the type inference process. We get a UType (not a UPolytype) for the expression, which may contain some free unification or type variables, as well as a context of UPolytypes for any defined variables.

trivMod :: Syntax' s -> Module s t Source #

The trivial module for a given AST, with the empty context.