ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

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 | Ignore
Language | GHC2021

GHC.JS.JStg.Syntax

Contents

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

Description

- Domain and Purpose

  GHC.JS.JStg.Syntax defines the eDSL that the JS backend's runtime system is written in. Nothing fancy, its just a straightforward deeply embedded DSL.

  In general, one should not use these constructors explicitly in the JS backend. Instead, prefer using the combinators in GHC.JS.Make, if those are suitable then prefer using the patterns exported from this module

Synopsis

- data JStgStat
  - = DeclStat !Ident !(Maybe JStgExpr)
  - | ReturnStat JStgExpr
  - | IfStat JStgExpr JStgStat JStgStat
  - | WhileStat Bool JStgExpr JStgStat
  - | ForStat JStgStat JStgExpr JStgStat JStgStat
  - | ForInStat Bool Ident JStgExpr JStgStat
  - | SwitchStat JStgExpr [(JStgExpr, JStgStat)] JStgStat
  - | TryStat JStgStat Ident JStgStat JStgStat
  - | BlockStat [JStgStat]
  - | ApplStat JStgExpr [JStgExpr]
  - | UOpStat UOp JStgExpr
  - | AssignStat JStgExpr AOp JStgExpr
  - | LabelStat JsLabel JStgStat
  - | BreakStat (Maybe JsLabel)
  - | ContinueStat (Maybe JsLabel)
  - | FuncStat !Ident [Ident] JStgStat
- data JStgExpr
  - = ValExpr JVal
  - | SelExpr JStgExpr Ident
  - | IdxExpr JStgExpr JStgExpr
  - | InfixExpr Op JStgExpr JStgExpr
  - | UOpExpr UOp JStgExpr
  - | IfExpr JStgExpr JStgExpr JStgExpr
  - | ApplExpr JStgExpr [JStgExpr]
- data JVal
  - = JVar Ident
  - | JList [JStgExpr]
  - | JDouble SaneDouble
  - | JInt Integer
  - | JStr FastString
  - | JRegEx FastString
  - | JBool Bool
  - | JHash (UniqMap FastString JStgExpr)
  - | JFunc [Ident] JStgStat
- 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 AOp
  - = AssignOp
  - | AddAssignOp
  - | SubAssignOp
- data UOp
  - = NotOp
  - | BNotOp
  - | NegOp
  - | PlusOp
  - | NewOp
  - | TypeofOp
  - | DeleteOp
  - | YieldOp
  - | VoidOp
  - | PreIncOp
  - | PostIncOp
  - | PreDecOp
  - | PostDecOp
- type JsLabel = LexicalFastString
- pattern New :: JStgExpr -> JStgExpr
- pattern Not :: JStgExpr -> JStgExpr
- pattern Negate :: JStgExpr -> JStgExpr
- pattern Add :: JStgExpr -> JStgExpr -> JStgExpr
- pattern Sub :: JStgExpr -> JStgExpr -> JStgExpr
- pattern Mul :: JStgExpr -> JStgExpr -> JStgExpr
- pattern Div :: JStgExpr -> JStgExpr -> JStgExpr
- pattern Mod :: JStgExpr -> JStgExpr -> JStgExpr
- pattern BOr :: JStgExpr -> JStgExpr -> JStgExpr
- pattern BAnd :: JStgExpr -> JStgExpr -> JStgExpr
- pattern BXor :: JStgExpr -> JStgExpr -> JStgExpr
- pattern BNot :: JStgExpr -> JStgExpr
- pattern LOr :: JStgExpr -> JStgExpr -> JStgExpr
- pattern LAnd :: JStgExpr -> JStgExpr -> JStgExpr
- pattern Int :: Integer -> JStgExpr
- pattern String :: FastString -> JStgExpr
- pattern Var :: Ident -> JStgExpr
- pattern PreInc :: JStgExpr -> JStgExpr
- pattern PostInc :: JStgExpr -> JStgExpr
- pattern PreDec :: JStgExpr -> JStgExpr
- pattern PostDec :: JStgExpr -> JStgExpr
- newtype SaneDouble = SaneDouble {
  - unSaneDouble :: Double
  }
- pattern Func :: [Ident] -> JStgStat -> JStgExpr
- global :: FastString -> JStgExpr
- local :: FastString -> JStgExpr

# Deeply embedded JS datatypes

data JStgStat Source #

JavaScript statements, see the ECMA262 Reference for details

Constructors

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

#### Instances

Instances details

Monoid JStgStat Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods mempty :: JStgStat Source # mappend :: JStgStat -> JStgStat -> JStgStat Source # mconcat :: [JStgStat] -> JStgStat Source #
Semigroup JStgStat Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (<>) :: JStgStat -> JStgStat -> JStgStat Source # sconcat :: NonEmpty JStgStat -> JStgStat Source # stimes :: Integral b => b -> JStgStat -> JStgStat Source #
Generic JStgStat Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep JStgStat |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JStgStat = D1 ('MetaData "JStgStat" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 JStgExpr))) :+: C1 ('MetaCons "ReturnStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: (C1 ('MetaCons "IfStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: C1 ('MetaCons "WhileStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))))) :+: ((C1 ('MetaCons "ForStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: 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 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)))) :+: (C1 ('MetaCons "SwitchStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(JStgExpr, JStgStat)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: C1 ('MetaCons "TryStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)))))) :+: (((C1 ('MetaCons "BlockStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgStat])) :+: C1 ('MetaCons "ApplStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgExpr]))) :+: (C1 ('MetaCons "UOpStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)) :+: C1 ('MetaCons "AssignStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))))) :+: ((C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)) :+: C1 ('MetaCons "BreakStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JsLabel)))) :+: (C1 ('MetaCons "ContinueStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JsLabel))) :+: 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 JStgStat)))))))

Methods

from :: JStgStat -> Rep JStgStat x Source #

to :: Rep JStgStat x -> JStgStat Source #

ToStat JStgStat Source # |
Instance details Defined in GHC.JS.Make Methods toStat :: JStgStat -> JStgStat Source #
Eq JStgStat Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: JStgStat -> JStgStat -> Bool Source # (/=) :: JStgStat -> JStgStat -> Bool Source #
ToStat [JStgStat] Source # |
Instance details Defined in GHC.JS.Make Methods toStat :: [JStgStat] -> JStgStat Source #
type Rep JStgStat Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JStgStat = D1 ('MetaData "JStgStat" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 JStgExpr))) :+: C1 ('MetaCons "ReturnStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: (C1 ('MetaCons "IfStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: C1 ('MetaCons "WhileStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))))) :+: ((C1 ('MetaCons "ForStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: 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 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)))) :+: (C1 ('MetaCons "SwitchStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(JStgExpr, JStgStat)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))) :+: C1 ('MetaCons "TryStat" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)))))) :+: (((C1 ('MetaCons "BlockStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgStat])) :+: C1 ('MetaCons "ApplStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgExpr]))) :+: (C1 ('MetaCons "UOpStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)) :+: C1 ('MetaCons "AssignStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))))) :+: ((C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat)) :+: C1 ('MetaCons "BreakStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JsLabel)))) :+: (C1 ('MetaCons "ContinueStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JsLabel))) :+: 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 JStgStat)))))))

data JStgExpr Source #

JavaScript Expressions

Constructors

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

#### Instances

Instances details

Generic JStgExpr Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep JStgExpr |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JStgExpr = D1 ('MetaData "JStgExpr" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "IdxExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)))) :+: ((C1 ('MetaCons "InfixExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Op) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: C1 ('MetaCons "UOpExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: (C1 ('MetaCons "IfExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: C1 ('MetaCons "ApplExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgExpr])))))

Methods

from :: JStgExpr -> Rep JStgExpr x Source #

to :: Rep JStgExpr x -> JStgExpr Source #

Num JStgExpr Source # |
Instance details Defined in GHC.JS.Make Methods (+) :: JStgExpr -> JStgExpr -> JStgExpr Source # (-) :: JStgExpr -> JStgExpr -> JStgExpr Source # (*) :: JStgExpr -> JStgExpr -> JStgExpr Source # negate :: JStgExpr -> JStgExpr Source # abs :: JStgExpr -> JStgExpr Source # signum :: JStgExpr -> JStgExpr Source # fromInteger :: Integer -> JStgExpr Source #
Fractional JStgExpr Source # |
Instance details Defined in GHC.JS.Make Methods (/) :: JStgExpr -> JStgExpr -> JStgExpr Source # recip :: JStgExpr -> JStgExpr Source # fromRational :: Rational -> JStgExpr Source #
JVarMagic JStgExpr Source # |
Instance details Defined in GHC.JS.Make Methods fresh :: JSM JStgExpr Source #
ToJExpr JStgExpr Source # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: JStgExpr -> JStgExpr Source # toJExprFromList :: [JStgExpr] -> JStgExpr Source #
ToStat JStgExpr Source # |
Instance details Defined in GHC.JS.Make Methods toStat :: JStgExpr -> JStgStat Source #
Outputable JStgExpr Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods ppr :: JStgExpr -> SDoc Source #
Eq JStgExpr Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: JStgExpr -> JStgExpr -> Bool Source # (/=) :: JStgExpr -> JStgExpr -> Bool Source #
ToStat [JStgExpr] Source # |
Instance details Defined in GHC.JS.Make Methods toStat :: [JStgExpr] -> JStgStat Source #
type Rep JStgExpr Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JStgExpr = D1 ('MetaData "JStgExpr" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: C1 ('MetaCons "IdxExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr)))) :+: ((C1 ('MetaCons "InfixExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Op) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: C1 ('MetaCons "UOpExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: (C1 ('MetaCons "IfExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr))) :+: C1 ('MetaCons "ApplExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JStgExpr])))))

data JVal Source #

JavaScript values

Constructors

JVar Ident | A variable reference
JList [JStgExpr] | 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 JStgExpr) | A JS HashMap: `{"foo": 0}`
JFunc [Ident] JStgStat | A function

#### Instances

Instances details

Generic JVal Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep JVal |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 [JStgExpr]))) :+: (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 JStgExpr))) :+: C1 ('MetaCons "JFunc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))))))

Methods

from :: JVal -> Rep JVal x Source #

to :: Rep JVal x -> JVal Source #

JVarMagic JVal Source # |
Instance details Defined in GHC.JS.Make Methods fresh :: JSM JVal Source #
ToJExpr JVal Source # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: JVal -> JStgExpr Source # toJExprFromList :: [JVal] -> JStgExpr Source #
Eq JVal Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: JVal -> JVal -> Bool Source # (/=) :: JVal -> JVal -> Bool Source #
type Rep JVal Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 [JStgExpr]))) :+: (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 JStgExpr))) :+: C1 ('MetaCons "JFunc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ident]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JStgStat))))))

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.JStg.Syntax Methods rnf :: Op -> () Source #
Data Op Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Methods

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

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

toConstr :: Op -> Constr Source #

dataTypeOf :: Op -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Enum Op Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods succ :: Op -> Op Source # pred :: Op -> Op Source # toEnum :: Int -> Op Source # fromEnum :: Op -> Int Source # enumFrom :: Op -> [Op] Source # enumFromThen :: Op -> Op -> [Op] Source # enumFromTo :: Op -> Op -> [Op] Source # enumFromThenTo :: Op -> Op -> Op -> [Op] Source #
Generic Op Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep Op |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep Op = D1 ('MetaData "Op" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 Source #

to :: Rep Op x -> Op Source #

Show Op Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods showsPrec :: Int -> Op -> ShowS Source # show :: Op -> String Source # showList :: [Op] -> ShowS Source #
Eq Op Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: Op -> Op -> Bool Source # (/=) :: Op -> Op -> Bool Source #
Ord Op Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods compare :: Op -> Op -> Ordering Source # (<) :: Op -> Op -> Bool Source # (<=) :: Op -> Op -> Bool Source # (>) :: Op -> Op -> Bool Source # (>=) :: Op -> Op -> Bool Source # max :: Op -> Op -> Op Source # min :: Op -> Op -> Op Source #
type Rep Op Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep Op = D1 ('MetaData "Op" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 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.JStg.Syntax Methods rnf :: AOp -> () Source #
Data AOp Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Methods

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

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

toConstr :: AOp -> Constr Source #

dataTypeOf :: AOp -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Enum AOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods succ :: AOp -> AOp Source # pred :: AOp -> AOp Source # toEnum :: Int -> AOp Source # fromEnum :: AOp -> Int Source # enumFrom :: AOp -> [AOp] Source # enumFromThen :: AOp -> AOp -> [AOp] Source # enumFromTo :: AOp -> AOp -> [AOp] Source # enumFromThenTo :: AOp -> AOp -> AOp -> [AOp] Source #
Generic AOp Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep AOp |
Instance details Defined in GHC.JS.JStg.Syntax type Rep AOp = D1 ('MetaData "AOp" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 Source #

to :: Rep AOp x -> AOp Source #

Show AOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods showsPrec :: Int -> AOp -> ShowS Source # show :: AOp -> String Source # showList :: [AOp] -> ShowS Source #
Eq AOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: AOp -> AOp -> Bool Source # (/=) :: AOp -> AOp -> Bool Source #
Ord AOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods compare :: AOp -> AOp -> Ordering Source # (<) :: AOp -> AOp -> Bool Source # (<=) :: AOp -> AOp -> Bool Source # (>) :: AOp -> AOp -> Bool Source # (>=) :: AOp -> AOp -> Bool Source # max :: AOp -> AOp -> AOp Source # min :: AOp -> AOp -> AOp Source #
type Rep AOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax type Rep AOp = D1 ('MetaData "AOp" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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)))

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.JStg.Syntax Methods rnf :: UOp -> () Source #
Data UOp Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Methods

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

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

toConstr :: UOp -> Constr Source #

dataTypeOf :: UOp -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Enum UOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods succ :: UOp -> UOp Source # pred :: UOp -> UOp Source # toEnum :: Int -> UOp Source # fromEnum :: UOp -> Int Source # enumFrom :: UOp -> [UOp] Source # enumFromThen :: UOp -> UOp -> [UOp] Source # enumFromTo :: UOp -> UOp -> [UOp] Source # enumFromThenTo :: UOp -> UOp -> UOp -> [UOp] Source #
Generic UOp Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

Associated Types

type Rep UOp |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep UOp = D1 ('MetaData "UOp" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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 Source #

to :: Rep UOp x -> UOp Source #

Show UOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods showsPrec :: Int -> UOp -> ShowS Source # show :: UOp -> String Source # showList :: [UOp] -> ShowS Source #
Eq UOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods (==) :: UOp -> UOp -> Bool Source # (/=) :: UOp -> UOp -> Bool Source #
Ord UOp Source # |
Instance details Defined in GHC.JS.JStg.Syntax Methods compare :: UOp -> UOp -> Ordering Source # (<) :: UOp -> UOp -> Bool Source # (<=) :: UOp -> UOp -> Bool Source # (>) :: UOp -> UOp -> Bool Source # (>=) :: UOp -> UOp -> Bool Source # max :: UOp -> UOp -> UOp Source # min :: UOp -> UOp -> UOp Source #
type Rep UOp Source # |

Instance details

Defined in GHC.JS.JStg.Syntax

type Rep UOp = D1 ('MetaData "UOp" "GHC.JS.JStg.Syntax" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" '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)))))

type JsLabel = LexicalFastString Source #

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

# pattern synonyms over JS operators

pattern New :: JStgExpr -> JStgExpr Source #

pattern synonym for a unary operator new

pattern Not :: JStgExpr -> JStgExpr Source #

pattern synonym for logical not `!`

pattern Negate :: JStgExpr -> JStgExpr Source #

pattern synonym for unary negation `-`

pattern Add :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for addition `+`

pattern Sub :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for subtraction `-`

pattern Mul :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for multiplication `*`

pattern Div :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for division `*`

pattern Mod :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for remainder `%`

pattern BOr :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for Bitwise Or `|`

pattern BAnd :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for Bitwise And `&`

pattern BXor :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for Bitwise XOr `^`

pattern BNot :: JStgExpr -> JStgExpr Source #

pattern synonym for Bitwise Not `~`

pattern LOr :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for logical Or `||`

pattern LAnd :: JStgExpr -> JStgExpr -> JStgExpr Source #

pattern synonym for logical And `&&`

pattern Int :: Integer -> JStgExpr Source #

pattern synonym to create integer values

pattern String :: FastString -> JStgExpr Source #

pattern synonym to create string values

pattern Var :: Ident -> JStgExpr Source #

pattern synonym to create a local variable reference

pattern PreInc :: JStgExpr -> JStgExpr Source #

pattern synonym for prefix increment `++x`

pattern PostInc :: JStgExpr -> JStgExpr Source #

pattern synonym for postfix increment `x++`

pattern PreDec :: JStgExpr -> JStgExpr Source #

pattern synonym for prefix decrement `--x`

pattern PostDec :: JStgExpr -> JStgExpr 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

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

Instance details

Defined in GHC.Types.SaneDouble

Methods

compare :: SaneDouble -> SaneDouble -> Ordering Source #

(<) :: SaneDouble -> SaneDouble -> Bool Source #

(<=) :: SaneDouble -> SaneDouble -> Bool Source #

(>) :: SaneDouble -> SaneDouble -> Bool Source #

(>=) :: SaneDouble -> SaneDouble -> Bool Source #

max :: SaneDouble -> SaneDouble -> SaneDouble Source #

min :: SaneDouble -> SaneDouble -> SaneDouble Source #

pattern Func :: [Ident] -> JStgStat -> JStgExpr Source #

pattern synonym to create an anonymous function

global :: FastString -> JStgExpr Source #

construct a JS reference, intended to refer to a global name

local :: FastString -> JStgExpr Source #

construct a JS reference, intended to refer to a local name