Language.PureScript.CoreImp.AST

purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.CoreImp.AST

Description

Data types for the imperative core AST

Synopsis

- data UnaryOperator
  - = Negate
  - | Not
  - | BitwiseNot
  - | Positive
  - | New
- data BinaryOperator
  - = Add
  - | Subtract
  - | Multiply
  - | Divide
  - | Modulus
  - | EqualTo
  - | NotEqualTo
  - | LessThan
  - | LessThanOrEqualTo
  - | GreaterThan
  - | GreaterThanOrEqualTo
  - | And
  - | Or
  - | BitwiseAnd
  - | BitwiseOr
  - | BitwiseXor
  - | ShiftLeft
  - | ShiftRight
  - | ZeroFillShiftRight
- data CIComments
  - = SourceComments [Comment]
  - | PureAnnotation
- data InitializerEffects
  - = NoEffects
  - | UnknownEffects
- data AST
  - = NumericLiteral (Maybe SourceSpan) (Either Integer Double)
  - | StringLiteral (Maybe SourceSpan) PSString
  - | BooleanLiteral (Maybe SourceSpan) Bool
  - | Unary (Maybe SourceSpan) UnaryOperator AST
  - | Binary (Maybe SourceSpan) BinaryOperator AST AST
  - | ArrayLiteral (Maybe SourceSpan) [AST]
  - | Indexer (Maybe SourceSpan) AST AST
  - | ObjectLiteral (Maybe SourceSpan) [(PSString, AST)]
  - | Function (Maybe SourceSpan) (Maybe Text) [Text] AST
  - | App (Maybe SourceSpan) AST [AST]
  - | Var (Maybe SourceSpan) Text
  - | ModuleAccessor (Maybe SourceSpan) ModuleName PSString
  - | Block (Maybe SourceSpan) [AST]
  - | VariableIntroduction (Maybe SourceSpan) Text (Maybe (InitializerEffects, AST))
  - | Assignment (Maybe SourceSpan) AST AST
  - | While (Maybe SourceSpan) AST AST
  - | For (Maybe SourceSpan) Text AST AST AST
  - | ForIn (Maybe SourceSpan) Text AST AST
  - | IfElse (Maybe SourceSpan) AST AST (Maybe AST)
  - | Return (Maybe SourceSpan) AST
  - | ReturnNoResult (Maybe SourceSpan)
  - | Throw (Maybe SourceSpan) AST
  - | InstanceOf (Maybe SourceSpan) AST AST
  - | Comment CIComments AST
- withSourceSpan :: SourceSpan -> AST -> AST
- getSourceSpan :: AST -> Maybe SourceSpan
- everywhere :: (AST -> AST) -> AST -> AST
- everywhereTopDown :: (AST -> AST) -> AST -> AST
- everywhereTopDownM :: Monad m => (AST -> m AST) -> AST -> m AST
- everything :: (r -> r -> r) -> (AST -> r) -> AST -> r

# Documentation

data UnaryOperator #

Built-in unary operators

Constructors

Negate |
Not |
BitwiseNot |
Positive |
New |

#### Instances

Instances details

Show UnaryOperator # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods showsPrec :: Int -> UnaryOperator -> ShowS # show :: UnaryOperator -> String # showList :: [UnaryOperator] -> ShowS #
Eq UnaryOperator # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods (==) :: UnaryOperator -> UnaryOperator -> Bool # (/=) :: UnaryOperator -> UnaryOperator -> Bool #

data BinaryOperator #

Built-in binary operators

Constructors

Add |
Subtract |
Multiply |
Divide |
Modulus |
EqualTo |
NotEqualTo |
LessThan |
LessThanOrEqualTo |
GreaterThan |
GreaterThanOrEqualTo |
And |
Or |
BitwiseAnd |
BitwiseOr |
BitwiseXor |
ShiftLeft |
ShiftRight |
ZeroFillShiftRight |

#### Instances

Instances details

Show BinaryOperator # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods showsPrec :: Int -> BinaryOperator -> ShowS # show :: BinaryOperator -> String # showList :: [BinaryOperator] -> ShowS #
Eq BinaryOperator # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods (==) :: BinaryOperator -> BinaryOperator -> Bool # (/=) :: BinaryOperator -> BinaryOperator -> Bool #

data CIComments #

Data type for CoreImp comments, which can come from either the PureScript source or internal transformations.

Constructors

SourceComments [Comment] |
PureAnnotation |

#### Instances

Instances details

Show CIComments # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods showsPrec :: Int -> CIComments -> ShowS # show :: CIComments -> String # showList :: [CIComments] -> ShowS #
Eq CIComments # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods (==) :: CIComments -> CIComments -> Bool # (/=) :: CIComments -> CIComments -> Bool #

data InitializerEffects #

Indicates whether the initializer of a variable is known not to have side effects, and thus can be inlined if needed or removed if unneeded.

Constructors

NoEffects |
UnknownEffects |

#### Instances

Instances details

Show InitializerEffects # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods showsPrec :: Int -> InitializerEffects -> ShowS # show :: InitializerEffects -> String # showList :: [InitializerEffects] -> ShowS #
Eq InitializerEffects # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods (==) :: InitializerEffects -> InitializerEffects -> Bool # (/=) :: InitializerEffects -> InitializerEffects -> Bool #

data AST #

Data type for simplified JavaScript expressions

Constructors

NumericLiteral (Maybe SourceSpan) (Either Integer Double) | A numeric literal
StringLiteral (Maybe SourceSpan) PSString | A string literal
BooleanLiteral (Maybe SourceSpan) Bool | A boolean literal
Unary (Maybe SourceSpan) UnaryOperator AST | A unary operator application
Binary (Maybe SourceSpan) BinaryOperator AST AST | A binary operator application
ArrayLiteral (Maybe SourceSpan) [AST] | An array literal
Indexer (Maybe SourceSpan) AST AST | An array indexer expression
ObjectLiteral (Maybe SourceSpan) [(PSString, AST)] | An object literal
Function (Maybe SourceSpan) (Maybe Text) [Text] AST | A function introduction (optional name, arguments, body)
App (Maybe SourceSpan) AST [AST] | Function application
Var (Maybe SourceSpan) Text | Variable
ModuleAccessor (Maybe SourceSpan) ModuleName PSString | Value from another module
Block (Maybe SourceSpan) [AST] | A block of expressions in braces
VariableIntroduction (Maybe SourceSpan) Text (Maybe (InitializerEffects, AST)) | A variable introduction and optional initialization
Assignment (Maybe SourceSpan) AST AST | A variable assignment
While (Maybe SourceSpan) AST AST | While loop
For (Maybe SourceSpan) Text AST AST AST | For loop
ForIn (Maybe SourceSpan) Text AST AST | ForIn loop
IfElse (Maybe SourceSpan) AST AST (Maybe AST) | If-then-else statement
Return (Maybe SourceSpan) AST | Return statement
ReturnNoResult (Maybe SourceSpan) | Return statement with no return value
Throw (Maybe SourceSpan) AST | Throw statement
InstanceOf (Maybe SourceSpan) AST AST | instanceof check
Comment CIComments AST | Commented JavaScript

#### Instances

Instances details

Show AST # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods showsPrec :: Int -> AST -> ShowS # show :: AST -> String # showList :: [AST] -> ShowS #
Eq AST # |
Instance details Defined in Language.PureScript.CoreImp.AST Methods (==) :: AST -> AST -> Bool # (/=) :: AST -> AST -> Bool #

withSourceSpan :: SourceSpan -> AST -> AST #

getSourceSpan :: AST -> Maybe SourceSpan #

everywhere :: (AST -> AST) -> AST -> AST #

everywhereTopDown :: (AST -> AST) -> AST -> AST #

everywhereTopDownM :: Monad m => (AST -> m AST) -> AST -> m AST #

everything :: (r -> r -> r) -> (AST -> r) -> AST -> r #