ghc-lib-parser-9.8.2.20240223: 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 | None
Language | Haskell2010

GHC.JS.Unsat.Syntax

Contents

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

Description

- Domain and Purpose

  GHC.JS.Unsat.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 embeded 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 JUOp JExpr
  - | AssignStat JExpr JExpr
  - | UnsatBlock (IdentSupply JStat)
  - | LabelStat JsLabel JStat
  - | BreakStat (Maybe JsLabel)
  - | ContinueStat (Maybe JsLabel)
  - | FuncStat !Ident [Ident] JStat
- data JExpr
  - = ValExpr JVal
  - | SelExpr JExpr Ident
  - | IdxExpr JExpr JExpr
  - | InfixExpr JOp JExpr JExpr
  - | UOpExpr JUOp JExpr
  - | IfExpr JExpr JExpr JExpr
  - | ApplExpr JExpr [JExpr]
  - | UnsatExpr (IdentSupply JExpr)
- data JVal
  - = JVar Ident
  - | JList [JExpr]
  - | JDouble SaneDouble
  - | JInt Integer
  - | JStr FastString
  - | JRegEx FastString
  - | JHash (UniqMap FastString JExpr)
  - | JFunc [Ident] JStat
  - | UnsatVal (IdentSupply JVal)
- data JOp
  - = EqOp
  - | StrictEqOp
  - | NeqOp
  - | StrictNeqOp
  - | GtOp
  - | GeOp
  - | LtOp
  - | LeOp
  - | AddOp
  - | SubOp
  - | MulOp
  - | DivOp
  - | ModOp
  - | LeftShiftOp
  - | RightShiftOp
  - | ZRightShiftOp
  - | BAndOp
  - | BOrOp
  - | BXorOp
  - | LAndOp
  - | LOrOp
  - | InstanceofOp
  - | InOp
- data JUOp
  - = NotOp
  - | BNotOp
  - | NegOp
  - | PlusOp
  - | NewOp
  - | TypeofOp
  - | DeleteOp
  - | YieldOp
  - | VoidOp
  - | PreIncOp
  - | PostIncOp
  - | PreDecOp
  - | PostDecOp
- newtype Ident = TxtI {
  - itxt :: FastString
  }
- identFS :: Ident -> FastString
- type JsLabel = 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 PreInc :: JExpr -> JExpr
- pattern PostInc :: JExpr -> JExpr
- pattern PreDec :: JExpr -> JExpr
- pattern PostDec :: JExpr -> JExpr
- newtype IdentSupply a = IS {
  - runIdentSupply :: State [Ident] a
  }
- newIdentSupply :: Maybe FastString -> [Ident]
- pseudoSaturate :: IdentSupply a -> a
- newtype SaneDouble = SaneDouble {
  - unSaneDouble :: Double
  }

# Deeply embedded JS datatypes

data JStat #

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 JUOp JExpr | Unary operators
AssignStat JExpr JExpr | Binding form: `foo = bar`
UnsatBlock (IdentSupply JStat) | Unsaturated blocks see `pseudoSaturate`
LabelStat JsLabel JStat | Statement Labels, makes me nostalgic for qbasic
BreakStat (Maybe JsLabel) | Break
ContinueStat (Maybe JsLabel) | Continue
FuncStat !Ident [Ident] JStat | an explicit function definition

#### Instances

Instances details

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

Instance details

Defined in GHC.JS.Unsat.Syntax

Associated Types

type Rep JStat |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JStat = D1 ('MetaData "JStat" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 JUOp) :*: 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 JExpr)))) :+: ((C1 ('MetaCons "UnsatBlock" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JStat))) :+: C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsLabel) :*: 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 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 JStat))))))))

Methods

from :: JStat -> Rep JStat x #

to :: Rep JStat x -> JStat #

ToStat JStat # |
Instance details Defined in GHC.JS.Make Methods toStat :: JStat -> JStat #
JMacro JStat # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JStat -> JMGadt JStat # jfromGADT :: JMGadt JStat -> JStat #
Eq JStat # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods (==) :: JStat -> JStat -> Bool # (/=) :: JStat -> JStat -> Bool #
ToStat [JStat] # |
Instance details Defined in GHC.JS.Make Methods toStat :: [JStat] -> JStat #
type Rep JStat # |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JStat = D1 ('MetaData "JStat" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 JUOp) :*: 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 JExpr)))) :+: ((C1 ('MetaCons "UnsatBlock" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JStat))) :+: C1 ('MetaCons "LabelStat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsLabel) :*: 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 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 JStat))))))))

data JExpr #

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 JOp JExpr JExpr | Infix Expressions, see `JExpr` pattern synonyms
UOpExpr JUOp JExpr | Unary Expressions
IfExpr JExpr JExpr JExpr | If-expression
ApplExpr JExpr [JExpr] | Application
UnsatExpr (IdentSupply JExpr) | An Saturated expression. See `pseudoSaturate`

#### Instances

Instances details

Generic JExpr # |

Instance details

Defined in GHC.JS.Unsat.Syntax

Associated Types

type Rep JExpr |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JExpr = D1 ('MetaData "JExpr" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 JOp) :*: (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 JUOp) :*: 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])) :+: C1 ('MetaCons "UnsatExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JExpr))))))

Methods

from :: JExpr -> Rep JExpr x #

to :: Rep JExpr x -> JExpr #

Num JExpr # |
Instance details Defined in GHC.JS.Make Methods (+) :: JExpr -> JExpr -> JExpr # (-) :: JExpr -> JExpr -> JExpr # (*) :: JExpr -> JExpr -> JExpr # negate :: JExpr -> JExpr # abs :: JExpr -> JExpr # signum :: JExpr -> JExpr # fromInteger :: Integer -> JExpr #
Fractional JExpr # |
Instance details Defined in GHC.JS.Make Methods (/) :: JExpr -> JExpr -> JExpr # recip :: JExpr -> JExpr # fromRational :: Rational -> JExpr #
ToJExpr JExpr # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: JExpr -> JExpr # toJExprFromList :: [JExpr] -> JExpr #
ToStat JExpr # |
Instance details Defined in GHC.JS.Make Methods toStat :: JExpr -> JStat #
JMacro JExpr # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JExpr -> JMGadt JExpr # jfromGADT :: JMGadt JExpr -> JExpr #
Eq JExpr # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods (==) :: JExpr -> JExpr -> Bool # (/=) :: JExpr -> JExpr -> Bool #
ToStat [JExpr] # |
Instance details Defined in GHC.JS.Make Methods toStat :: [JExpr] -> JStat #
type Rep JExpr # |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JExpr = D1 ('MetaData "JExpr" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 JOp) :*: (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 JUOp) :*: 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])) :+: C1 ('MetaCons "UnsatExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JExpr))))))

data JVal #

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
JHash (UniqMap FastString JExpr) | A JS HashMap: `{"foo": 0}`
JFunc [Ident] JStat | A function
UnsatVal (IdentSupply JVal) | An Saturated value, see `pseudoSaturate`

#### Instances

Instances details

Generic JVal # |

Instance details

Defined in GHC.JS.Unsat.Syntax

Associated Types

type Rep JVal |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 "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)) :+: C1 ('MetaCons "UnsatVal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JVal)))))))

Methods

from :: JVal -> Rep JVal x #

to :: Rep JVal x -> JVal #

ToJExpr JVal # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: JVal -> JExpr # toJExprFromList :: [JVal] -> JExpr #
JMacro JVal # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JVal -> JMGadt JVal # jfromGADT :: JMGadt JVal -> JVal #
Eq JVal # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods (==) :: JVal -> JVal -> Bool # (/=) :: JVal -> JVal -> Bool #
type Rep JVal # |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JVal = D1 ('MetaData "JVal" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 "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)) :+: C1 ('MetaCons "UnsatVal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IdentSupply JVal)))))))

data JOp #

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

Data JOp # |

Instance details

Defined in GHC.JS.Unsat.Syntax

Methods

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

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

toConstr :: JOp -> Constr #

dataTypeOf :: JOp -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Instance details

Defined in GHC.JS.Unsat.Syntax

Associated Types

type Rep JOp |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JOp = D1 ('MetaData "JOp" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 :: JOp -> Rep JOp x #

to :: Rep JOp x -> JOp #

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

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JOp = D1 ('MetaData "JOp" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 JUOp #

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

Data JUOp # |

Instance details

Defined in GHC.JS.Unsat.Syntax

Methods

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

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

toConstr :: JUOp -> Constr #

dataTypeOf :: JUOp -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Instance details

Defined in GHC.JS.Unsat.Syntax

Associated Types

type Rep JUOp |

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JUOp = D1 ('MetaData "JUOp" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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 :: JUOp -> Rep JUOp x #

to :: Rep JUOp x -> JUOp #

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

Instance details

Defined in GHC.JS.Unsat.Syntax

type Rep JUOp = D1 ('MetaData "JUOp" "GHC.JS.Unsat.Syntax" "ghc-lib-parser-9.8.2.20240223-9NuDRGXaSwDKa1fvIVmpae" '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)))))

newtype Ident #

A newtype wrapper around `FastString` for JS identifiers.

Constructors

TxtI |

Fields

- itxt :: FastString

#### Instances

Instances details

Show Ident # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods showsPrec :: Int -> Ident -> ShowS # show :: Ident -> String # showList :: [Ident] -> ShowS #
ToJExpr Ident # |
Instance details Defined in GHC.JS.Make Methods toJExpr :: Ident -> JExpr # toJExprFromList :: [Ident] -> JExpr #
JsToDoc Ident # |
Instance details Defined in GHC.JS.Ppr Methods jsToDocR :: JsRender doc => RenderJs doc -> Ident -> doc #
JMacro Ident # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: Ident -> JMGadt Ident # jfromGADT :: JMGadt Ident -> Ident #
Uniquable Ident # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods getUnique :: Ident -> Unique #
Binary Ident # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: BinHandle -> Ident -> IO () # put :: BinHandle -> Ident -> IO (Bin Ident) # get :: BinHandle -> IO Ident #
Eq Ident # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods (==) :: Ident -> Ident -> Bool # (/=) :: Ident -> Ident -> Bool #

identFS :: Ident -> FastString #

type JsLabel = LexicalFastString #

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

# pattern synonyms over JS operators

pattern New :: JExpr -> JExpr #

pattern synonym for a unary operator new

pattern Not :: JExpr -> JExpr #

pattern synonym for logical not `!`

pattern Negate :: JExpr -> JExpr #

pattern synonym for unary negation `-`

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

pattern synonym for addition `+`

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

pattern synonym for subtraction `-`

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

pattern synonym for multiplication `*`

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

pattern synonym for division `*`

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

pattern synonym for remainder `%`

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

pattern synonym for Bitwise Or `|`

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

pattern synonym for Bitwise And `&`

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

pattern synonym for Bitwise XOr `^`

pattern BNot :: JExpr -> JExpr #

pattern synonym for Bitwise Not `~`

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

pattern synonym for logical Or `||`

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

pattern synonym for logical And `&&`

pattern Int :: Integer -> JExpr #

pattern synonym to create integer values

pattern String :: FastString -> JExpr #

pattern synonym to create string values

pattern PreInc :: JExpr -> JExpr #

pattern synonym for prefix increment `++x`

pattern PostInc :: JExpr -> JExpr #

pattern synonym for postfix increment `x++`

pattern PreDec :: JExpr -> JExpr #

pattern synonym for prefix decrement `--x`

pattern PostDec :: JExpr -> JExpr #

pattern synonym for postfix decrement `--x`

# Ident supply

newtype IdentSupply a #

A supply of identifiers, possibly empty

Constructors

IS |

Fields

- runIdentSupply :: State [Ident] a

#### Instances

Instances details

Functor IdentSupply # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods fmap :: (a -> b) -> IdentSupply a -> IdentSupply b # (<$) :: a -> IdentSupply b -> IdentSupply a #
Show a => Show (IdentSupply a) # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods showsPrec :: Int -> IdentSupply a -> ShowS # show :: IdentSupply a -> String # showList :: [IdentSupply a] -> ShowS #
NFData (IdentSupply a) # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods rnf :: IdentSupply a -> () #
Eq a => Eq (IdentSupply a) # |
Instance details Defined in GHC.JS.Unsat.Syntax Methods (==) :: IdentSupply a -> IdentSupply a -> Bool # (/=) :: IdentSupply a -> IdentSupply a -> Bool #
Ord a => Ord (IdentSupply a) # |

Instance details

Defined in GHC.JS.Unsat.Syntax

Methods

compare :: IdentSupply a -> IdentSupply a -> Ordering #

(<) :: IdentSupply a -> IdentSupply a -> Bool #

(<=) :: IdentSupply a -> IdentSupply a -> Bool #

(>) :: IdentSupply a -> IdentSupply a -> Bool #

(>=) :: IdentSupply a -> IdentSupply a -> Bool #

max :: IdentSupply a -> IdentSupply a -> IdentSupply a #

min :: IdentSupply a -> IdentSupply a -> IdentSupply a #

newIdentSupply :: Maybe FastString -> [Ident] #

pseudoSaturate :: IdentSupply a -> a #

Given a Pseudo-saturate a value with garbage `` identifiers.

# Utility

newtype SaneDouble #

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 # |
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 # |
Instance details Defined in GHC.Types.SaneDouble Methods (/) :: SaneDouble -> SaneDouble -> SaneDouble # recip :: SaneDouble -> SaneDouble # fromRational :: Rational -> SaneDouble #
Show SaneDouble # |
Instance details Defined in GHC.Types.SaneDouble Methods showsPrec :: Int -> SaneDouble -> ShowS # show :: SaneDouble -> String # showList :: [SaneDouble] -> ShowS #
Binary SaneDouble # |
Instance details Defined in GHC.Types.SaneDouble Methods put_ :: BinHandle -> SaneDouble -> IO () # put :: BinHandle -> SaneDouble -> IO (Bin SaneDouble) # get :: BinHandle -> IO SaneDouble #
Eq SaneDouble # |
Instance details Defined in GHC.Types.SaneDouble Methods (==) :: SaneDouble -> SaneDouble -> Bool # (/=) :: SaneDouble -> SaneDouble -> Bool #
Ord SaneDouble # |
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 #