GHC.JS.Syntax

ghc-9.10.0.20240413: The GHC API

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file LICENSE)
Maintainer | Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io>
Stability | experimental
Safe Haskell | None
Language | GHC2021

GHC.JS.Syntax

Contents

- Deeply embedded JS datatypes
- pattern synonyms over JS operators
- Utility

Description

- Domain and Purpose

  GHC.JS.Syntax defines the Syntax for the JS backend in GHC. It comports with the ECMA-262 although not every production rule of the standard is represented. Code in this module is a fork of JMacro (BSD 3 Clause) by Gershom Bazerman, heavily modified to accomodate GHC's constraints.

- Strategy

  Nothing fancy in this module, this is a classic deeply embedded AST for JS. We define numerous ADTs and pattern synonyms to make pattern matching and constructing ASTs easier.

- Consumers

  The entire JS backend consumes this module, e.g., the modules in GHC.StgToJS.*. Please see `Make` for a module which provides helper functions that use the deeply embedded DSL defined in this module to provide some of the benefits of a shallow embedding.

Synopsis

- data JStat
  - = DeclStat !Ident !(Maybe JExpr)
  - | ReturnStat JExpr
  - | IfStat JExpr JStat JStat
  - | WhileStat Bool JExpr JStat
  - | ForStat JStat JExpr JStat JStat
  - | ForInStat Bool Ident JExpr JStat
  - | SwitchStat JExpr [(JExpr, JStat)] JStat
  - | TryStat JStat Ident JStat JStat
  - | BlockStat [JStat]
  - | ApplStat JExpr [JExpr]
  - | UOpStat UOp JExpr
  - | AssignStat JExpr AOp JExpr
  - | LabelStat JLabel JStat
  - | BreakStat (Maybe JLabel)
  - | ContinueStat (Maybe JLabel)
  - | FuncStat !Ident [Ident] JStat
- data JExpr
  - = ValExpr JVal
  - | SelExpr JExpr Ident
  - | IdxExpr JExpr JExpr
  - | InfixExpr Op JExpr JExpr
  - | UOpExpr UOp JExpr
  - | IfExpr JExpr JExpr JExpr
  - | ApplExpr JExpr [JExpr]
- data JVal
  - = JVar Ident
  - | JList [JExpr]
  - | JDouble SaneDouble
  - | JInt Integer
  - | JStr FastString
  - | JRegEx FastString
  - | JBool Bool
  - | JHash (UniqMap FastString JExpr)
  - | JFunc [Ident] JStat
- data Op
  - = EqOp
  - | StrictEqOp
  - | NeqOp
  - | StrictNeqOp
  - | GtOp
  - | GeOp
  - | LtOp
  - | LeOp
  - | AddOp
  - | SubOp
  - | MulOp
  - | DivOp
  - | ModOp
  - | LeftShiftOp
  - | RightShiftOp
  - | ZRightShiftOp
  - | BAndOp
  - | BOrOp
  - | BXorOp
  - | LAndOp
  - | LOrOp
  - | InstanceofOp
  - | InOp
- data UOp
  - = NotOp
  - | BNotOp
  - | NegOp
  - | PlusOp
  - | NewOp
  - | TypeofOp
  - | DeleteOp
  - | YieldOp
  - | VoidOp
  - | PreIncOp
  - | PostIncOp
  - | PreDecOp
  - | PostDecOp
- data AOp
  - = AssignOp
  - | AddAssignOp
  - | SubAssignOp
- newtype Ident = TxtI {
  - identFS :: FastString
  }
- type JLabel = LexicalFastString
- pattern New :: JExpr -> JExpr
- pattern Not :: JExpr -> JExpr
- pattern Negate :: JExpr -> JExpr
- pattern Add :: JExpr -> JExpr -> JExpr
- pattern Sub :: JExpr -> JExpr -> JExpr
- pattern Mul :: JExpr -> JExpr -> JExpr
- pattern Div :: JExpr -> JExpr -> JExpr
- pattern Mod :: JExpr -> JExpr -> JExpr
- pattern BOr :: JExpr -> JExpr -> JExpr
- pattern BAnd :: JExpr -> JExpr -> JExpr
- pattern BXor :: JExpr -> JExpr -> JExpr
- pattern BNot :: JExpr -> JExpr
- pattern LOr :: JExpr -> JExpr -> JExpr
- pattern LAnd :: JExpr -> JExpr -> JExpr
- pattern Int :: Integer -> JExpr
- pattern String :: FastString -> JExpr
- pattern Var :: Ident -> JExpr
- pattern PreInc :: JExpr -> JExpr
- pattern PostInc :: JExpr -> JExpr
- pattern PreDec :: JExpr -> JExpr
- pattern PostDec :: JExpr -> JExpr
- newtype SaneDouble = SaneDouble {
  - unSaneDouble :: Double
  }
- var :: FastString -> JExpr
- true_ :: JExpr
- false_ :: JExpr

# Deeply embedded JS datatypes

data JStat Source #

JavaScript statements, see the ECMA262 Reference for details

Constructors

DeclStat !Ident !(Maybe JExpr) | Variable declarations: var foo [= e]
ReturnStat JExpr | Return
IfStat JExpr JStat JStat | If
WhileStat Bool JExpr JStat | While, bool is "do" when True
ForStat JStat JExpr JStat JStat | For
ForInStat Bool Ident JExpr JStat | For-in, bool is "each' when True
SwitchStat JExpr [(JExpr, JStat)] JStat | Switch
TryStat JStat Ident JStat JStat | Try
BlockStat [JStat] | Blocks
ApplStat JExpr [JExpr] | Application
UOpStat UOp JExpr | Unary operators
AssignStat JExpr AOp JExpr | Binding form: `foo op bar`
LabelStat JLabel JStat | Statement Labels, makes me nostalgic for qbasic
BreakStat (Maybe JLabel) | Break
ContinueStat (Maybe JLabel) | Continue
FuncStat !Ident [Ident] JStat | an explicit function definition

#### Instances

Instances details

JsToDoc JStat Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> JStat -> doc Source #
Binary JStat Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> JStat -> IO () Source # put :: BinHandle -> JStat -> IO (Bin JStat) Source # get :: BinHandle -> IO JStat Source #
Monoid JStat Source # |
Instance details Defined in GHC.JS.Syntax Methods mempty :: JStat # mappend :: JStat -> JStat -> JStat # mconcat :: [JStat] -> JStat #
Semigroup JStat Source # |
Instance details Defined in GHC.JS.Syntax Methods (<>) :: JStat -> JStat -> JStat # sconcat :: NonEmpty JStat -> JStat # stimes :: Integral b => b -> JStat -> JStat #
Generic JStat Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep JStat |
Instance details Defined in GHC.JS.Syntax type Rep JStat = D1 ('MetaData "JStat" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((((C1 ('MetaCons "DeclStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Ident) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe JExpr))) :+: C1 ('MetaCons "ReturnStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: (C1 ('MetaCons "IfStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "WhileStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))))) :+: ((C1 ('MetaCons "ForStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "ForInStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))) :+: (C1 ('MetaCons "SwitchStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(JExpr, JStat)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "TryStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))))) :+: (((C1 ('MetaCons "BlockStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStat])) :+: C1 ('MetaCons "ApplStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr]))) :+: (C1 ('MetaCons "UOpStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)) :+: C1 ('MetaCons "AssignStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))))) :+: ((C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)) :+: C1 ('MetaCons "BreakStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JLabel)))) :+: (C1 ('MetaCons "ContinueStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JLabel))) :+: C1 ('MetaCons "FuncStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Ident) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))))))
Methods from :: JStat -> Rep JStat x # to :: Rep JStat x -> JStat #
Eq JStat Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: JStat -> JStat -> Bool # (/=) :: JStat -> JStat -> Bool #
JsToDoc [JStat] Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> [JStat] -> doc Source #
type Rep JStat Source # |
Instance details Defined in GHC.JS.Syntax type Rep JStat = D1 ('MetaData "JStat" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((((C1 ('MetaCons "DeclStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Ident) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe JExpr))) :+: C1 ('MetaCons "ReturnStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: (C1 ('MetaCons "IfStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "WhileStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))))) :+: ((C1 ('MetaCons "ForStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "ForInStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))) :+: (C1 ('MetaCons "SwitchStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(JExpr, JStat)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))) :+: C1 ('MetaCons "TryStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))))) :+: (((C1 ('MetaCons "BlockStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStat])) :+: C1 ('MetaCons "ApplStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr]))) :+: (C1 ('MetaCons "UOpStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)) :+: C1 ('MetaCons "AssignStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))))) :+: ((C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)) :+: C1 ('MetaCons "BreakStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JLabel)))) :+: (C1 ('MetaCons "ContinueStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JLabel))) :+: C1 ('MetaCons "FuncStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Ident) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat)))))))

data JExpr Source #

JavaScript Expressions

Constructors

ValExpr JVal | All values are trivially expressions
SelExpr JExpr Ident | Selection: Obj.foo, see `.^`
IdxExpr JExpr JExpr | Indexing: Obj[foo], see `.!`
InfixExpr Op JExpr JExpr | Infix Expressions, see `JExpr` pattern synonyms
UOpExpr UOp JExpr | Unary Expressions
IfExpr JExpr JExpr JExpr | If-expression
ApplExpr JExpr [JExpr] | Application

#### Instances

Instances details

JsToDoc JExpr Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> JExpr -> doc Source #
Binary JExpr Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> JExpr -> IO () Source # put :: BinHandle -> JExpr -> IO (Bin JExpr) Source # get :: BinHandle -> IO JExpr Source #
Outputable JExpr Source # |
Instance details Defined in GHC.JS.Ppr Methods ppr :: JExpr -> SDoc Source #
Generic JExpr Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep JExpr |
Instance details Defined in GHC.JS.Syntax type Rep JExpr = D1 ('MetaData "JExpr" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((C1 ('MetaCons "ValExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JVal)) :+: (C1 ('MetaCons "SelExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "IdxExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)))) :+: ((C1 ('MetaCons "InfixExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Op) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: C1 ('MetaCons "UOpExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: (C1 ('MetaCons "IfExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: C1 ('MetaCons "ApplExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr])))))
Methods from :: JExpr -> Rep JExpr x # to :: Rep JExpr x -> JExpr #
Eq JExpr Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: JExpr -> JExpr -> Bool # (/=) :: JExpr -> JExpr -> Bool #
JsToDoc [JExpr] Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> [JExpr] -> doc Source #
type Rep JExpr Source # |
Instance details Defined in GHC.JS.Syntax type Rep JExpr = D1 ('MetaData "JExpr" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((C1 ('MetaCons "ValExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JVal)) :+: (C1 ('MetaCons "SelExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "IdxExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr)))) :+: ((C1 ('MetaCons "InfixExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Op) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: C1 ('MetaCons "UOpExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: (C1 ('MetaCons "IfExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr))) :+: C1 ('MetaCons "ApplExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr])))))

data JVal Source #

JavaScript values

Constructors

JVar Ident | A variable reference
JList [JExpr] | A JavaScript list, or what JS calls an Array
JDouble SaneDouble | A Double
JInt Integer | A BigInt
JStr FastString | A String
JRegEx FastString | A Regex
JBool Bool | A Boolean
JHash (UniqMap FastString JExpr) | A JS HashMap: `{"foo": 0}`
JFunc [Ident] JStat | A function

#### Instances

Instances details

JsToDoc JVal Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> JVal -> doc Source #
Binary JVal Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> JVal -> IO () Source # put :: BinHandle -> JVal -> IO (Bin JVal) Source # get :: BinHandle -> IO JVal Source #
Outputable JVal Source # |
Instance details Defined in GHC.JS.Ppr Methods ppr :: JVal -> SDoc Source #
Generic JVal Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep JVal |
Instance details Defined in GHC.JS.Syntax type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (((C1 ('MetaCons "JVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "JList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr]))) :+: (C1 ('MetaCons "JDouble" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SaneDouble)) :+: C1 ('MetaCons "JInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))) :+: ((C1 ('MetaCons "JStr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FastString)) :+: C1 ('MetaCons "JRegEx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FastString))) :+: (C1 ('MetaCons "JBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: (C1 ('MetaCons "JHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UniqMap FastString JExpr))) :+: C1 ('MetaCons "JFunc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))))))
Methods from :: JVal -> Rep JVal x # to :: Rep JVal x -> JVal #
Eq JVal Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: JVal -> JVal -> Bool # (/=) :: JVal -> JVal -> Bool #
type Rep JVal Source # |
Instance details Defined in GHC.JS.Syntax type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (((C1 ('MetaCons "JVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "JList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JExpr]))) :+: (C1 ('MetaCons "JDouble" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SaneDouble)) :+: C1 ('MetaCons "JInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))) :+: ((C1 ('MetaCons "JStr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FastString)) :+: C1 ('MetaCons "JRegEx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FastString))) :+: (C1 ('MetaCons "JBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: (C1 ('MetaCons "JHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UniqMap FastString JExpr))) :+: C1 ('MetaCons "JFunc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStat))))))

data Op Source #

JS Binary Operators. We do not deeply embed the comma operator and the assignment operators

Constructors

EqOp | Equality: `==`
StrictEqOp | Strict Equality: `===`
NeqOp | InEquality: `!=`
StrictNeqOp | Strict InEquality `!==`
GtOp | Greater Than: `>`
GeOp | Greater Than or Equal: `>=`
LtOp | Less Than: <
LeOp | Less Than or Equal: <=
AddOp | Addition: +
SubOp | Subtraction: -
MulOp | Multiplication *
DivOp | Division: /
ModOp | Remainder: %
LeftShiftOp | Left Shift: <<
RightShiftOp | Right Shift: >>
ZRightShiftOp | Unsigned RightShift: >>>
BAndOp | Bitwise And: &
BOrOp | Bitwise Or: |
BXorOp | Bitwise XOr: ^
LAndOp | Logical And: &&
LOrOp | Logical Or: ||
InstanceofOp |
    instanceof
InOp |
    in

#### Instances

Instances details

NFData Op Source # |
Instance details Defined in GHC.JS.Syntax Methods rnf :: Op -> () Source #
Binary Op Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> Op -> IO () Source # put :: BinHandle -> Op -> IO (Bin Op) Source # get :: BinHandle -> IO Op Source #
Data Op Source # |
Instance details Defined in GHC.JS.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Op -> c Op # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Op # toConstr :: Op -> Constr # dataTypeOf :: Op -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Op) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Op) # gmapT :: (forall b. Data b => b -> b) -> Op -> Op # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r # gmapQ :: (forall d. Data d => d -> u) -> Op -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Op -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Op -> m Op # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Op -> m Op # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Op -> m Op #
Enum Op Source # |
Instance details Defined in GHC.JS.Syntax Methods succ :: Op -> Op # pred :: Op -> Op # toEnum :: Int -> Op # fromEnum :: Op -> Int # enumFrom :: Op -> [Op] # enumFromThen :: Op -> Op -> [Op] # enumFromTo :: Op -> Op -> [Op] # enumFromThenTo :: Op -> Op -> Op -> [Op] #
Generic Op Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep Op |
Instance details Defined in GHC.JS.Syntax type Rep Op = D1 ('MetaData "Op" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((((C1 ('MetaCons "EqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StrictEqOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "StrictNeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GtOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "GeOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LtOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LeOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "AddOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SubOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MulOp" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "DivOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ModOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LeftShiftOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "RightShiftOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ZRightShiftOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BAndOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "BOrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BXorOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LAndOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LOrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InstanceofOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "InOp" 'PrefixI 'False) (U1 :: Type -> Type))))))
Methods from :: Op -> Rep Op x # to :: Rep Op x -> Op #
Show Op Source # |
Instance details Defined in GHC.JS.Syntax Methods showsPrec :: Int -> Op -> ShowS # show :: Op -> String # showList :: [Op] -> ShowS #
Eq Op Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: Op -> Op -> Bool # (/=) :: Op -> Op -> Bool #
Ord Op Source # |
Instance details Defined in GHC.JS.Syntax Methods compare :: Op -> Op -> Ordering # (<) :: Op -> Op -> Bool # (<=) :: Op -> Op -> Bool # (>) :: Op -> Op -> Bool # (>=) :: Op -> Op -> Bool # max :: Op -> Op -> Op # min :: Op -> Op -> Op #
type Rep Op Source # |
Instance details Defined in GHC.JS.Syntax type Rep Op = D1 ('MetaData "Op" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) ((((C1 ('MetaCons "EqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StrictEqOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "StrictNeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GtOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "GeOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LtOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LeOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "AddOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SubOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MulOp" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "DivOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ModOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LeftShiftOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "RightShiftOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ZRightShiftOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BAndOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "BOrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BXorOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LAndOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LOrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InstanceofOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "InOp" 'PrefixI 'False) (U1 :: Type -> Type))))))

data UOp Source #

JS Unary Operators

Constructors

NotOp | Logical Not: `!`
BNotOp | Bitwise Not: `~`
NegOp | Negation: `-`
PlusOp | Unary Plus: `+x`
NewOp | new x
TypeofOp | typeof x
DeleteOp | delete x
YieldOp | yield x
VoidOp | void x
PreIncOp | Prefix Increment: `++x`
PostIncOp | Postfix Increment: `x++`
PreDecOp | Prefix Decrement: `--x`
PostDecOp | Postfix Decrement: `x--`

#### Instances

Instances details

NFData UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods rnf :: UOp -> () Source #
Binary UOp Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> UOp -> IO () Source # put :: BinHandle -> UOp -> IO (Bin UOp) Source # get :: BinHandle -> IO UOp Source #
Data UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UOp -> c UOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UOp # toConstr :: UOp -> Constr # dataTypeOf :: UOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp) # gmapT :: (forall b. Data b => b -> b) -> UOp -> UOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r # gmapQ :: (forall d. Data d => d -> u) -> UOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UOp -> m UOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UOp -> m UOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UOp -> m UOp #
Enum UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods succ :: UOp -> UOp # pred :: UOp -> UOp # toEnum :: Int -> UOp # fromEnum :: UOp -> Int # enumFrom :: UOp -> [UOp] # enumFromThen :: UOp -> UOp -> [UOp] # enumFromTo :: UOp -> UOp -> [UOp] # enumFromThenTo :: UOp -> UOp -> UOp -> [UOp] #
Generic UOp Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep UOp |
Instance details Defined in GHC.JS.Syntax type Rep UOp = D1 ('MetaData "UOp" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (((C1 ('MetaCons "NotOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BNotOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NegOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PlusOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NewOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TypeofOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "DeleteOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "YieldOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "VoidOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "PreIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PostIncOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PreDecOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PostDecOp" 'PrefixI 'False) (U1 :: Type -> Type)))))
Methods from :: UOp -> Rep UOp x # to :: Rep UOp x -> UOp #
Show UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods showsPrec :: Int -> UOp -> ShowS # show :: UOp -> String # showList :: [UOp] -> ShowS #
Eq UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: UOp -> UOp -> Bool # (/=) :: UOp -> UOp -> Bool #
Ord UOp Source # |
Instance details Defined in GHC.JS.Syntax Methods compare :: UOp -> UOp -> Ordering # (<) :: UOp -> UOp -> Bool # (<=) :: UOp -> UOp -> Bool # (>) :: UOp -> UOp -> Bool # (>=) :: UOp -> UOp -> Bool # max :: UOp -> UOp -> UOp # min :: UOp -> UOp -> UOp #
type Rep UOp Source # |
Instance details Defined in GHC.JS.Syntax type Rep UOp = D1 ('MetaData "UOp" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (((C1 ('MetaCons "NotOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BNotOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NegOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PlusOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NewOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TypeofOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "DeleteOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "YieldOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "VoidOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "PreIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PostIncOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PreDecOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PostDecOp" 'PrefixI 'False) (U1 :: Type -> Type)))))

data AOp Source #

JS Unary Operators

Constructors

AssignOp | Vanilla Assignment: =
AddAssignOp | Addition Assignment: +=
SubAssignOp | Subtraction Assignment: -=

#### Instances

Instances details

NFData AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods rnf :: AOp -> () Source #
Binary AOp Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> AOp -> IO () Source # put :: BinHandle -> AOp -> IO (Bin AOp) Source # get :: BinHandle -> IO AOp Source #
Data AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AOp -> c AOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AOp # toConstr :: AOp -> Constr # dataTypeOf :: AOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AOp) # gmapT :: (forall b. Data b => b -> b) -> AOp -> AOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r # gmapQ :: (forall d. Data d => d -> u) -> AOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AOp -> m AOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AOp -> m AOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AOp -> m AOp #
Enum AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods succ :: AOp -> AOp # pred :: AOp -> AOp # toEnum :: Int -> AOp # fromEnum :: AOp -> Int # enumFrom :: AOp -> [AOp] # enumFromThen :: AOp -> AOp -> [AOp] # enumFromTo :: AOp -> AOp -> [AOp] # enumFromThenTo :: AOp -> AOp -> AOp -> [AOp] #
Generic AOp Source # |
Instance details Defined in GHC.JS.Syntax Associated Types
type Rep AOp |
Instance details Defined in GHC.JS.Syntax type Rep AOp = D1 ('MetaData "AOp" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (C1 ('MetaCons "AssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AddAssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SubAssignOp" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: AOp -> Rep AOp x # to :: Rep AOp x -> AOp #
Show AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods showsPrec :: Int -> AOp -> ShowS # show :: AOp -> String # showList :: [AOp] -> ShowS #
Eq AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods (==) :: AOp -> AOp -> Bool # (/=) :: AOp -> AOp -> Bool #
Ord AOp Source # |
Instance details Defined in GHC.JS.Syntax Methods compare :: AOp -> AOp -> Ordering # (<) :: AOp -> AOp -> Bool # (<=) :: AOp -> AOp -> Bool # (>) :: AOp -> AOp -> Bool # (>=) :: AOp -> AOp -> Bool # max :: AOp -> AOp -> AOp # min :: AOp -> AOp -> AOp #
type Rep AOp Source # |
Instance details Defined in GHC.JS.Syntax type Rep AOp = D1 ('MetaData "AOp" "GHC.JS.Syntax" "ghc-9.10.0.20240413-3de5" 'False) (C1 ('MetaCons "AssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AddAssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SubAssignOp" 'PrefixI 'False) (U1 :: Type -> Type)))

newtype Ident Source #

A newtype wrapper around `FastString` for JS identifiers.

Constructors

TxtI |
Fields identFS :: FastString

#### Instances

Instances details

JVarMagic Ident Source # |
Instance details Defined in GHC.JS.Make Methods fresh :: JSM Ident Source #
ToJExpr Ident Source # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: Ident -> JStgExpr Source # toJExprFromList :: [Ident] -> JStgExpr Source #
JsToDoc Ident Source # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> Ident -> doc Source #
Uniquable Ident Source # |
Instance details Defined in GHC.JS.Ident Methods getUnique :: Ident -> Unique Source #
Binary Ident Source # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> Ident -> IO () Source # put :: BinHandle -> Ident -> IO (Bin Ident) Source # get :: BinHandle -> IO Ident Source #
Show Ident Source # |
Instance details Defined in GHC.JS.Ident Methods showsPrec :: Int -> Ident -> ShowS # show :: Ident -> String # showList :: [Ident] -> ShowS #
Eq Ident Source # |
Instance details Defined in GHC.JS.Ident Methods (==) :: Ident -> Ident -> Bool # (/=) :: Ident -> Ident -> Bool #

type JLabel = LexicalFastString Source #

A Label used for `JStat`, specifically `BreakStat`, `ContinueStat` and of course `LabelStat`

# pattern synonyms over JS operators

pattern New :: JExpr -> JExpr Source #

pattern synonym for a unary operator new

pattern Not :: JExpr -> JExpr Source #

pattern synonym for logical not `!`

pattern Negate :: JExpr -> JExpr Source #

pattern synonym for unary negation `-`

pattern Add :: JExpr -> JExpr -> JExpr Source #

pattern synonym for addition `+`

pattern Sub :: JExpr -> JExpr -> JExpr Source #

pattern synonym for subtraction `-`

pattern Mul :: JExpr -> JExpr -> JExpr Source #

pattern synonym for multiplication `*`

pattern Div :: JExpr -> JExpr -> JExpr Source #

pattern synonym for division `*`

pattern Mod :: JExpr -> JExpr -> JExpr Source #

pattern synonym for remainder `%`

pattern BOr :: JExpr -> JExpr -> JExpr Source #

pattern synonym for Bitwise Or `|`

pattern BAnd :: JExpr -> JExpr -> JExpr Source #

pattern synonym for Bitwise And `&`

pattern BXor :: JExpr -> JExpr -> JExpr Source #

pattern synonym for Bitwise XOr `^`

pattern BNot :: JExpr -> JExpr Source #

pattern synonym for Bitwise Not `~`

pattern LOr :: JExpr -> JExpr -> JExpr Source #

pattern synonym for logical Or `||`

pattern LAnd :: JExpr -> JExpr -> JExpr Source #

pattern synonym for logical And `&&`

pattern Int :: Integer -> JExpr Source #

pattern synonym to create integer values

pattern String :: FastString -> JExpr Source #

pattern synonym to create string values

pattern Var :: Ident -> JExpr Source #

pattern synonym to create a local variable reference

pattern PreInc :: JExpr -> JExpr Source #

pattern synonym for prefix increment `++x`

pattern PostInc :: JExpr -> JExpr Source #

pattern synonym for postfix increment `x++`

pattern PreDec :: JExpr -> JExpr Source #

pattern synonym for prefix decrement `--x`

pattern PostDec :: JExpr -> JExpr Source #

pattern synonym for postfix decrement `--x`

# Utility

newtype SaneDouble Source #

A newtype wrapper around `Double` to ensure we never generate a `Double` that becomes a `NaN`, see instances for details on sanity.

Constructors

SaneDouble |
Fields unSaneDouble :: Double

#### Instances

Instances details

Binary SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods put_ :: BinHandle -> SaneDouble -> IO () Source # put :: BinHandle -> SaneDouble -> IO (Bin SaneDouble) Source # get :: BinHandle -> IO SaneDouble Source #
Num SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods (+) :: SaneDouble -> SaneDouble -> SaneDouble # (-) :: SaneDouble -> SaneDouble -> SaneDouble # (*) :: SaneDouble -> SaneDouble -> SaneDouble # negate :: SaneDouble -> SaneDouble # abs :: SaneDouble -> SaneDouble # signum :: SaneDouble -> SaneDouble # fromInteger :: Integer -> SaneDouble #
Fractional SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods (/) :: SaneDouble -> SaneDouble -> SaneDouble # recip :: SaneDouble -> SaneDouble # fromRational :: Rational -> SaneDouble #
Show SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods showsPrec :: Int -> SaneDouble -> ShowS # show :: SaneDouble -> String # showList :: [SaneDouble] -> ShowS #
Eq SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods (==) :: SaneDouble -> SaneDouble -> Bool # (/=) :: SaneDouble -> SaneDouble -> Bool #
Ord SaneDouble Source # |
Instance details Defined in GHC.Types.SaneDouble Methods compare :: SaneDouble -> SaneDouble -> Ordering # (<) :: SaneDouble -> SaneDouble -> Bool # (<=) :: SaneDouble -> SaneDouble -> Bool # (>) :: SaneDouble -> SaneDouble -> Bool # (>=) :: SaneDouble -> SaneDouble -> Bool # max :: SaneDouble -> SaneDouble -> SaneDouble # min :: SaneDouble -> SaneDouble -> SaneDouble #

var :: FastString -> JExpr Source #

construct a JS variable reference

true_ :: JExpr Source #

The JS literal `true`

false_ :: JExpr Source #

The JS literal `false`