{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE PatternSynonyms #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  GHC.JS.JStg.Syntax
-- 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
--
--
-- * 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

-----------------------------------------------------------------------------
module GHC.JS.JStg.Syntax
  ( -- * Deeply embedded JS datatypes
    JStgStat(..)
  , JStgExpr(..)
  , JVal(..)
  , Op(..)
  , AOp(..)
  , UOp(..)
  , JsLabel
  -- * pattern synonyms over JS operators
  , pattern New
  , pattern Not
  , pattern Negate
  , pattern Add
  , pattern Sub
  , pattern Mul
  , pattern Div
  , pattern Mod
  , pattern BOr
  , pattern BAnd
  , pattern BXor
  , pattern BNot
  , pattern LOr
  , pattern LAnd
  , pattern Int
  , pattern String
  , pattern Var
  , pattern PreInc
  , pattern PostInc
  , pattern PreDec
  , pattern PostDec
  -- * Utility
  , SaneDouble(..)
  , pattern Func
  , global
  , local
  ) where

import GHC.Prelude
import GHC.Utils.Outputable

import GHC.JS.Ident

import Control.DeepSeq

import Data.Data
import qualified Data.Semigroup as Semigroup

import GHC.Generics

import GHC.Data.FastString
import GHC.Types.Unique.Map
import GHC.Types.SaneDouble

--------------------------------------------------------------------------------
--                            Statements
--------------------------------------------------------------------------------
-- | JavaScript statements, see the [ECMA262
-- Reference](https://tc39.es/ecma262/#sec-ecmascript-language-statements-and-declarations)
-- for details
data JStgStat
  = 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
  deriving (JStgStat -> JStgStat -> Bool
(JStgStat -> JStgStat -> Bool)
-> (JStgStat -> JStgStat -> Bool) -> Eq JStgStat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JStgStat -> JStgStat -> Bool
== :: JStgStat -> JStgStat -> Bool
$c/= :: JStgStat -> JStgStat -> Bool
/= :: JStgStat -> JStgStat -> Bool
Eq, (forall x. JStgStat -> Rep JStgStat x)
-> (forall x. Rep JStgStat x -> JStgStat) -> Generic JStgStat
forall x. Rep JStgStat x -> JStgStat
forall x. JStgStat -> Rep JStgStat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JStgStat -> Rep JStgStat x
from :: forall x. JStgStat -> Rep JStgStat x
$cto :: forall x. Rep JStgStat x -> JStgStat
to :: forall x. Rep JStgStat x -> JStgStat
Generic)

-- | A Label used for 'JStgStat', specifically 'BreakStat', 'ContinueStat' and of
-- course 'LabelStat'
type JsLabel = LexicalFastString

instance Semigroup JStgStat where
  <> :: JStgStat -> JStgStat -> JStgStat
(<>) = JStgStat -> JStgStat -> JStgStat
appendJStgStat

instance Monoid JStgStat where
  mempty :: JStgStat
mempty = [JStgStat] -> JStgStat
BlockStat []

-- | Append a statement to another statement. 'appendJStgStat' only returns a
-- 'JStgStat' that is /not/ a 'BlockStat' when either @mx@ or @my is an empty
-- 'BlockStat'. That is:
-- > (BlockStat [] , y           ) = y
-- > (x            , BlockStat []) = x
appendJStgStat :: JStgStat -> JStgStat -> JStgStat
appendJStgStat :: JStgStat -> JStgStat -> JStgStat
appendJStgStat JStgStat
mx JStgStat
my = case (JStgStat
mx,JStgStat
my) of
  (BlockStat [] , JStgStat
y           ) -> JStgStat
y
  (JStgStat
x            , BlockStat []) -> JStgStat
x
  (BlockStat [JStgStat]
xs , BlockStat [JStgStat]
ys) -> [JStgStat] -> JStgStat
BlockStat ([JStgStat] -> JStgStat) -> [JStgStat] -> JStgStat
forall a b. (a -> b) -> a -> b
$ [JStgStat]
xs [JStgStat] -> [JStgStat] -> [JStgStat]
forall a. [a] -> [a] -> [a]
++ [JStgStat]
ys
  (BlockStat [JStgStat]
xs , JStgStat
ys          ) -> [JStgStat] -> JStgStat
BlockStat ([JStgStat] -> JStgStat) -> [JStgStat] -> JStgStat
forall a b. (a -> b) -> a -> b
$ [JStgStat]
xs [JStgStat] -> [JStgStat] -> [JStgStat]
forall a. [a] -> [a] -> [a]
++ [JStgStat
ys]
  (JStgStat
xs           , BlockStat [JStgStat]
ys) -> [JStgStat] -> JStgStat
BlockStat ([JStgStat] -> JStgStat) -> [JStgStat] -> JStgStat
forall a b. (a -> b) -> a -> b
$ JStgStat
xs JStgStat -> [JStgStat] -> [JStgStat]
forall a. a -> [a] -> [a]
: [JStgStat]
ys
  (JStgStat
xs           , JStgStat
ys          ) -> [JStgStat] -> JStgStat
BlockStat [JStgStat
xs,JStgStat
ys]


--------------------------------------------------------------------------------
--                            Expressions
--------------------------------------------------------------------------------
-- | JavaScript Expressions
data JStgExpr
  = ValExpr    JVal                 -- ^ All values are trivially expressions
  | SelExpr    JStgExpr Ident       -- ^ Selection: Obj.foo, see 'GHC.JS.Make..^'
  | IdxExpr    JStgExpr JStgExpr    -- ^ Indexing:  Obj[foo], see 'GHC.JS.Make..!'
  | 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
  deriving (JStgExpr -> JStgExpr -> Bool
(JStgExpr -> JStgExpr -> Bool)
-> (JStgExpr -> JStgExpr -> Bool) -> Eq JStgExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JStgExpr -> JStgExpr -> Bool
== :: JStgExpr -> JStgExpr -> Bool
$c/= :: JStgExpr -> JStgExpr -> Bool
/= :: JStgExpr -> JStgExpr -> Bool
Eq, (forall x. JStgExpr -> Rep JStgExpr x)
-> (forall x. Rep JStgExpr x -> JStgExpr) -> Generic JStgExpr
forall x. Rep JStgExpr x -> JStgExpr
forall x. JStgExpr -> Rep JStgExpr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JStgExpr -> Rep JStgExpr x
from :: forall x. JStgExpr -> Rep JStgExpr x
$cto :: forall x. Rep JStgExpr x -> JStgExpr
to :: forall x. Rep JStgExpr x -> JStgExpr
Generic)

instance Outputable JStgExpr where
  ppr :: JStgExpr -> SDoc
ppr JStgExpr
x = case JStgExpr
x of
    ValExpr JVal
_ -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"ValExpr" :: String)
    SelExpr JStgExpr
x' Ident
_ -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"SelExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> JStgExpr -> SDoc
forall a. Outputable a => a -> SDoc
ppr JStgExpr
x'
    IdxExpr JStgExpr
x' JStgExpr
y' -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"IdxExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (JStgExpr, JStgExpr) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (JStgExpr
x', JStgExpr
y')
    InfixExpr Op
_ JStgExpr
x' JStgExpr
y' -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"InfixExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (JStgExpr, JStgExpr) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (JStgExpr
x', JStgExpr
y')
    UOpExpr UOp
_ JStgExpr
x' -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"UOpExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> JStgExpr -> SDoc
forall a. Outputable a => a -> SDoc
ppr JStgExpr
x'
    IfExpr JStgExpr
p JStgExpr
t JStgExpr
e -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"IfExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (JStgExpr, JStgExpr, JStgExpr) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (JStgExpr
p, JStgExpr
t, JStgExpr
e)
    ApplExpr JStgExpr
x' [JStgExpr]
xs -> String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"ApplExpr" :: String) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (JStgExpr, [JStgExpr]) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (JStgExpr
x', [JStgExpr]
xs)

-- * Useful pattern synonyms to ease programming with the deeply embedded JS
--   AST. Each pattern wraps @UOp@ and @Op@ into a @JStgExpr@s to save typing and
--   for convienience. In addition we include a string wrapper for JS string
--   and Integer literals.

-- | pattern synonym for a unary operator new
pattern New :: JStgExpr -> JStgExpr
pattern $mNew :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bNew :: JStgExpr -> JStgExpr
New x = UOpExpr NewOp x

-- | pattern synonym for prefix increment @++x@
pattern PreInc :: JStgExpr -> JStgExpr
pattern $mPreInc :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bPreInc :: JStgExpr -> JStgExpr
PreInc x = UOpExpr PreIncOp x

-- | pattern synonym for postfix increment @x++@
pattern PostInc :: JStgExpr -> JStgExpr
pattern $mPostInc :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bPostInc :: JStgExpr -> JStgExpr
PostInc x = UOpExpr PostIncOp x

-- | pattern synonym for prefix decrement @--x@
pattern PreDec :: JStgExpr -> JStgExpr
pattern $mPreDec :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bPreDec :: JStgExpr -> JStgExpr
PreDec x = UOpExpr PreDecOp x

-- | pattern synonym for postfix decrement @--x@
pattern PostDec :: JStgExpr -> JStgExpr
pattern $mPostDec :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bPostDec :: JStgExpr -> JStgExpr
PostDec x = UOpExpr PostDecOp x

-- | pattern synonym for logical not @!@
pattern Not :: JStgExpr -> JStgExpr
pattern $mNot :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bNot :: JStgExpr -> JStgExpr
Not x = UOpExpr NotOp x

-- | pattern synonym for unary negation @-@
pattern Negate :: JStgExpr -> JStgExpr
pattern $mNegate :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bNegate :: JStgExpr -> JStgExpr
Negate x = UOpExpr NegOp x

-- | pattern synonym for addition @+@
pattern Add :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mAdd :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bAdd :: JStgExpr -> JStgExpr -> JStgExpr
Add x y = InfixExpr AddOp x y

-- | pattern synonym for subtraction @-@
pattern Sub :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mSub :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bSub :: JStgExpr -> JStgExpr -> JStgExpr
Sub x y = InfixExpr SubOp x y

-- | pattern synonym for multiplication @*@
pattern Mul :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mMul :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bMul :: JStgExpr -> JStgExpr -> JStgExpr
Mul x y = InfixExpr MulOp x y

-- | pattern synonym for division @*@
pattern Div :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mDiv :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bDiv :: JStgExpr -> JStgExpr -> JStgExpr
Div x y = InfixExpr DivOp x y

-- | pattern synonym for remainder @%@
pattern Mod :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mMod :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bMod :: JStgExpr -> JStgExpr -> JStgExpr
Mod x y = InfixExpr ModOp x y

-- | pattern synonym for Bitwise Or @|@
pattern BOr :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mBOr :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bBOr :: JStgExpr -> JStgExpr -> JStgExpr
BOr x y = InfixExpr BOrOp x y

-- | pattern synonym for Bitwise And @&@
pattern BAnd :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mBAnd :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bBAnd :: JStgExpr -> JStgExpr -> JStgExpr
BAnd x y = InfixExpr BAndOp x y

-- | pattern synonym for Bitwise XOr @^@
pattern BXor :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mBXor :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bBXor :: JStgExpr -> JStgExpr -> JStgExpr
BXor x y = InfixExpr BXorOp x y

-- | pattern synonym for Bitwise Not @~@
pattern BNot :: JStgExpr -> JStgExpr
pattern $mBNot :: forall {r}. JStgExpr -> (JStgExpr -> r) -> ((# #) -> r) -> r
$bBNot :: JStgExpr -> JStgExpr
BNot x = UOpExpr BNotOp x

-- | pattern synonym for logical Or @||@
pattern LOr :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mLOr :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bLOr :: JStgExpr -> JStgExpr -> JStgExpr
LOr x y = InfixExpr LOrOp x y

-- | pattern synonym for logical And @&&@
pattern LAnd :: JStgExpr -> JStgExpr -> JStgExpr
pattern $mLAnd :: forall {r}.
JStgExpr -> (JStgExpr -> JStgExpr -> r) -> ((# #) -> r) -> r
$bLAnd :: JStgExpr -> JStgExpr -> JStgExpr
LAnd x y = InfixExpr LAndOp x y

-- | pattern synonym to create integer values
pattern Int :: Integer -> JStgExpr
pattern $mInt :: forall {r}. JStgExpr -> (Integer -> r) -> ((# #) -> r) -> r
$bInt :: Integer -> JStgExpr
Int x = ValExpr (JInt x)

-- | pattern synonym to create string values
pattern String :: FastString -> JStgExpr
pattern $mString :: forall {r}. JStgExpr -> (FastString -> r) -> ((# #) -> r) -> r
$bString :: FastString -> JStgExpr
String x = ValExpr (JStr x)

-- | pattern synonym to create a local variable reference
pattern Var :: Ident -> JStgExpr
pattern $mVar :: forall {r}. JStgExpr -> (Ident -> r) -> ((# #) -> r) -> r
$bVar :: Ident -> JStgExpr
Var x = ValExpr (JVar x)

-- | pattern synonym to create an anonymous function
pattern Func :: [Ident] -> JStgStat -> JStgExpr
pattern $mFunc :: forall {r}.
JStgExpr -> ([Ident] -> JStgStat -> r) -> ((# #) -> r) -> r
$bFunc :: [Ident] -> JStgStat -> JStgExpr
Func args body = ValExpr (JFunc args body)

--------------------------------------------------------------------------------
--                            Values
--------------------------------------------------------------------------------
-- | JavaScript values
data JVal
  = 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
  deriving (JVal -> JVal -> Bool
(JVal -> JVal -> Bool) -> (JVal -> JVal -> Bool) -> Eq JVal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JVal -> JVal -> Bool
== :: JVal -> JVal -> Bool
$c/= :: JVal -> JVal -> Bool
/= :: JVal -> JVal -> Bool
Eq, (forall x. JVal -> Rep JVal x)
-> (forall x. Rep JVal x -> JVal) -> Generic JVal
forall x. Rep JVal x -> JVal
forall x. JVal -> Rep JVal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JVal -> Rep JVal x
from :: forall x. JVal -> Rep JVal x
$cto :: forall x. Rep JVal x -> JVal
to :: forall x. Rep JVal x -> JVal
Generic)

--------------------------------------------------------------------------------
--                            Operators
--------------------------------------------------------------------------------
-- | JS Binary Operators. We do not deeply embed the comma operator and the
-- assignment operators
data Op
  = 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@
  deriving (Int -> Op -> ShowS
[Op] -> ShowS
Op -> String
(Int -> Op -> ShowS)
-> (Op -> String) -> ([Op] -> ShowS) -> Show Op
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Op -> ShowS
showsPrec :: Int -> Op -> ShowS
$cshow :: Op -> String
show :: Op -> String
$cshowList :: [Op] -> ShowS
showList :: [Op] -> ShowS
Show, Op -> Op -> Bool
(Op -> Op -> Bool) -> (Op -> Op -> Bool) -> Eq Op
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Op -> Op -> Bool
== :: Op -> Op -> Bool
$c/= :: Op -> Op -> Bool
/= :: Op -> Op -> Bool
Eq, Eq Op
Eq Op =>
(Op -> Op -> Ordering)
-> (Op -> Op -> Bool)
-> (Op -> Op -> Bool)
-> (Op -> Op -> Bool)
-> (Op -> Op -> Bool)
-> (Op -> Op -> Op)
-> (Op -> Op -> Op)
-> Ord Op
Op -> Op -> Bool
Op -> Op -> Ordering
Op -> Op -> Op
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Op -> Op -> Ordering
compare :: Op -> Op -> Ordering
$c< :: Op -> Op -> Bool
< :: Op -> Op -> Bool
$c<= :: Op -> Op -> Bool
<= :: Op -> Op -> Bool
$c> :: Op -> Op -> Bool
> :: Op -> Op -> Bool
$c>= :: Op -> Op -> Bool
>= :: Op -> Op -> Bool
$cmax :: Op -> Op -> Op
max :: Op -> Op -> Op
$cmin :: Op -> Op -> Op
min :: Op -> Op -> Op
Ord, Int -> Op
Op -> Int
Op -> [Op]
Op -> Op
Op -> Op -> [Op]
Op -> Op -> Op -> [Op]
(Op -> Op)
-> (Op -> Op)
-> (Int -> Op)
-> (Op -> Int)
-> (Op -> [Op])
-> (Op -> Op -> [Op])
-> (Op -> Op -> [Op])
-> (Op -> Op -> Op -> [Op])
-> Enum Op
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Op -> Op
succ :: Op -> Op
$cpred :: Op -> Op
pred :: Op -> Op
$ctoEnum :: Int -> Op
toEnum :: Int -> Op
$cfromEnum :: Op -> Int
fromEnum :: Op -> Int
$cenumFrom :: Op -> [Op]
enumFrom :: Op -> [Op]
$cenumFromThen :: Op -> Op -> [Op]
enumFromThen :: Op -> Op -> [Op]
$cenumFromTo :: Op -> Op -> [Op]
enumFromTo :: Op -> Op -> [Op]
$cenumFromThenTo :: Op -> Op -> Op -> [Op]
enumFromThenTo :: Op -> Op -> Op -> [Op]
Enum, Typeable Op
Typeable Op =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Op -> c Op)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Op)
-> (Op -> Constr)
-> (Op -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Op))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Op))
-> ((forall b. Data b => b -> b) -> Op -> Op)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r)
-> (forall u. (forall d. Data d => d -> u) -> Op -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Op -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Op -> m Op)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Op -> m Op)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Op -> m Op)
-> Data Op
Op -> Constr
Op -> DataType
(forall b. Data b => b -> b) -> Op -> Op
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Op -> u
forall u. (forall d. Data d => d -> u) -> Op -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Op -> m Op
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Op -> m Op
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Op
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Op -> c Op
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Op)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Op)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Op -> c Op
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Op -> c Op
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Op
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Op
$ctoConstr :: Op -> Constr
toConstr :: Op -> Constr
$cdataTypeOf :: Op -> DataType
dataTypeOf :: Op -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Op)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Op)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Op)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Op)
$cgmapT :: (forall b. Data b => b -> b) -> Op -> Op
gmapT :: (forall b. Data b => b -> b) -> Op -> Op
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Op -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Op -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Op -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Op -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Op -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Op -> m Op
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Op -> m Op
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Op -> m Op
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Op -> m Op
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Op -> m Op
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Op -> m Op
Data, (forall x. Op -> Rep Op x)
-> (forall x. Rep Op x -> Op) -> Generic Op
forall x. Rep Op x -> Op
forall x. Op -> Rep Op x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Op -> Rep Op x
from :: forall x. Op -> Rep Op x
$cto :: forall x. Rep Op x -> Op
to :: forall x. Rep Op x -> Op
Generic)

instance NFData Op

-- | JS Unary Operators
data UOp
  = 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--@
  deriving (Int -> UOp -> ShowS
[UOp] -> ShowS
UOp -> String
(Int -> UOp -> ShowS)
-> (UOp -> String) -> ([UOp] -> ShowS) -> Show UOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UOp -> ShowS
showsPrec :: Int -> UOp -> ShowS
$cshow :: UOp -> String
show :: UOp -> String
$cshowList :: [UOp] -> ShowS
showList :: [UOp] -> ShowS
Show, UOp -> UOp -> Bool
(UOp -> UOp -> Bool) -> (UOp -> UOp -> Bool) -> Eq UOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UOp -> UOp -> Bool
== :: UOp -> UOp -> Bool
$c/= :: UOp -> UOp -> Bool
/= :: UOp -> UOp -> Bool
Eq, Eq UOp
Eq UOp =>
(UOp -> UOp -> Ordering)
-> (UOp -> UOp -> Bool)
-> (UOp -> UOp -> Bool)
-> (UOp -> UOp -> Bool)
-> (UOp -> UOp -> Bool)
-> (UOp -> UOp -> UOp)
-> (UOp -> UOp -> UOp)
-> Ord UOp
UOp -> UOp -> Bool
UOp -> UOp -> Ordering
UOp -> UOp -> UOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: UOp -> UOp -> Ordering
compare :: UOp -> UOp -> Ordering
$c< :: UOp -> UOp -> Bool
< :: UOp -> UOp -> Bool
$c<= :: UOp -> UOp -> Bool
<= :: UOp -> UOp -> Bool
$c> :: UOp -> UOp -> Bool
> :: UOp -> UOp -> Bool
$c>= :: UOp -> UOp -> Bool
>= :: UOp -> UOp -> Bool
$cmax :: UOp -> UOp -> UOp
max :: UOp -> UOp -> UOp
$cmin :: UOp -> UOp -> UOp
min :: UOp -> UOp -> UOp
Ord, Int -> UOp
UOp -> Int
UOp -> [UOp]
UOp -> UOp
UOp -> UOp -> [UOp]
UOp -> UOp -> UOp -> [UOp]
(UOp -> UOp)
-> (UOp -> UOp)
-> (Int -> UOp)
-> (UOp -> Int)
-> (UOp -> [UOp])
-> (UOp -> UOp -> [UOp])
-> (UOp -> UOp -> [UOp])
-> (UOp -> UOp -> UOp -> [UOp])
-> Enum UOp
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: UOp -> UOp
succ :: UOp -> UOp
$cpred :: UOp -> UOp
pred :: UOp -> UOp
$ctoEnum :: Int -> UOp
toEnum :: Int -> UOp
$cfromEnum :: UOp -> Int
fromEnum :: UOp -> Int
$cenumFrom :: UOp -> [UOp]
enumFrom :: UOp -> [UOp]
$cenumFromThen :: UOp -> UOp -> [UOp]
enumFromThen :: UOp -> UOp -> [UOp]
$cenumFromTo :: UOp -> UOp -> [UOp]
enumFromTo :: UOp -> UOp -> [UOp]
$cenumFromThenTo :: UOp -> UOp -> UOp -> [UOp]
enumFromThenTo :: UOp -> UOp -> UOp -> [UOp]
Enum, Typeable UOp
Typeable UOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> UOp -> c UOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UOp)
-> (UOp -> Constr)
-> (UOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp))
-> ((forall b. Data b => b -> b) -> UOp -> UOp)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> UOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UOp -> m UOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UOp -> m UOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UOp -> m UOp)
-> Data UOp
UOp -> Constr
UOp -> DataType
(forall b. Data b => b -> b) -> UOp -> UOp
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UOp -> u
forall u. (forall d. Data d => d -> u) -> UOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UOp -> c UOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UOp -> c UOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UOp -> c UOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UOp
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UOp
$ctoConstr :: UOp -> Constr
toConstr :: UOp -> Constr
$cdataTypeOf :: UOp -> DataType
dataTypeOf :: UOp -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp)
$cgmapT :: (forall b. Data b => b -> b) -> UOp -> UOp
gmapT :: (forall b. Data b => b -> b) -> UOp -> UOp
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UOp -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> UOp -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UOp -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UOp -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UOp -> m UOp
Data, (forall x. UOp -> Rep UOp x)
-> (forall x. Rep UOp x -> UOp) -> Generic UOp
forall x. Rep UOp x -> UOp
forall x. UOp -> Rep UOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UOp -> Rep UOp x
from :: forall x. UOp -> Rep UOp x
$cto :: forall x. Rep UOp x -> UOp
to :: forall x. Rep UOp x -> UOp
Generic)

instance NFData UOp

-- | JS Unary Operators
data AOp
  = AssignOp    -- ^ Vanilla  Assignment: =
  | AddAssignOp -- ^ Addition Assignment: +=
  | SubAssignOp -- ^ Subtraction Assignment: -=
  deriving (Int -> AOp -> ShowS
[AOp] -> ShowS
AOp -> String
(Int -> AOp -> ShowS)
-> (AOp -> String) -> ([AOp] -> ShowS) -> Show AOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AOp -> ShowS
showsPrec :: Int -> AOp -> ShowS
$cshow :: AOp -> String
show :: AOp -> String
$cshowList :: [AOp] -> ShowS
showList :: [AOp] -> ShowS
Show, AOp -> AOp -> Bool
(AOp -> AOp -> Bool) -> (AOp -> AOp -> Bool) -> Eq AOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AOp -> AOp -> Bool
== :: AOp -> AOp -> Bool
$c/= :: AOp -> AOp -> Bool
/= :: AOp -> AOp -> Bool
Eq, Eq AOp
Eq AOp =>
(AOp -> AOp -> Ordering)
-> (AOp -> AOp -> Bool)
-> (AOp -> AOp -> Bool)
-> (AOp -> AOp -> Bool)
-> (AOp -> AOp -> Bool)
-> (AOp -> AOp -> AOp)
-> (AOp -> AOp -> AOp)
-> Ord AOp
AOp -> AOp -> Bool
AOp -> AOp -> Ordering
AOp -> AOp -> AOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: AOp -> AOp -> Ordering
compare :: AOp -> AOp -> Ordering
$c< :: AOp -> AOp -> Bool
< :: AOp -> AOp -> Bool
$c<= :: AOp -> AOp -> Bool
<= :: AOp -> AOp -> Bool
$c> :: AOp -> AOp -> Bool
> :: AOp -> AOp -> Bool
$c>= :: AOp -> AOp -> Bool
>= :: AOp -> AOp -> Bool
$cmax :: AOp -> AOp -> AOp
max :: AOp -> AOp -> AOp
$cmin :: AOp -> AOp -> AOp
min :: AOp -> AOp -> AOp
Ord, Int -> AOp
AOp -> Int
AOp -> [AOp]
AOp -> AOp
AOp -> AOp -> [AOp]
AOp -> AOp -> AOp -> [AOp]
(AOp -> AOp)
-> (AOp -> AOp)
-> (Int -> AOp)
-> (AOp -> Int)
-> (AOp -> [AOp])
-> (AOp -> AOp -> [AOp])
-> (AOp -> AOp -> [AOp])
-> (AOp -> AOp -> AOp -> [AOp])
-> Enum AOp
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: AOp -> AOp
succ :: AOp -> AOp
$cpred :: AOp -> AOp
pred :: AOp -> AOp
$ctoEnum :: Int -> AOp
toEnum :: Int -> AOp
$cfromEnum :: AOp -> Int
fromEnum :: AOp -> Int
$cenumFrom :: AOp -> [AOp]
enumFrom :: AOp -> [AOp]
$cenumFromThen :: AOp -> AOp -> [AOp]
enumFromThen :: AOp -> AOp -> [AOp]
$cenumFromTo :: AOp -> AOp -> [AOp]
enumFromTo :: AOp -> AOp -> [AOp]
$cenumFromThenTo :: AOp -> AOp -> AOp -> [AOp]
enumFromThenTo :: AOp -> AOp -> AOp -> [AOp]
Enum, Typeable AOp
Typeable AOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> AOp -> c AOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AOp)
-> (AOp -> Constr)
-> (AOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AOp))
-> ((forall b. Data b => b -> b) -> AOp -> AOp)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> AOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> AOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AOp -> m AOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AOp -> m AOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AOp -> m AOp)
-> Data AOp
AOp -> Constr
AOp -> DataType
(forall b. Data b => b -> b) -> AOp -> AOp
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> AOp -> u
forall u. (forall d. Data d => d -> u) -> AOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AOp -> c AOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AOp)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AOp -> c AOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AOp -> c AOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AOp
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AOp
$ctoConstr :: AOp -> Constr
toConstr :: AOp -> Constr
$cdataTypeOf :: AOp -> DataType
dataTypeOf :: AOp -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AOp)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AOp)
$cgmapT :: (forall b. Data b => b -> b) -> AOp -> AOp
gmapT :: (forall b. Data b => b -> b) -> AOp -> AOp
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AOp -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> AOp -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> AOp -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AOp -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AOp -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AOp -> m AOp
Data, (forall x. AOp -> Rep AOp x)
-> (forall x. Rep AOp x -> AOp) -> Generic AOp
forall x. Rep AOp x -> AOp
forall x. AOp -> Rep AOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AOp -> Rep AOp x
from :: forall x. AOp -> Rep AOp x
$cto :: forall x. Rep AOp x -> AOp
to :: forall x. Rep AOp x -> AOp
Generic)

instance NFData AOp

-- | construct a JS reference, intended to refer to a global name
global :: FastString -> JStgExpr
global :: FastString -> JStgExpr
global = Ident -> JStgExpr
Var (Ident -> JStgExpr)
-> (FastString -> Ident) -> FastString -> JStgExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FastString -> Ident
name

-- | construct a JS reference, intended to refer to a local name
local :: FastString -> JStgExpr
local :: FastString -> JStgExpr
local = Ident -> JStgExpr
Var (Ident -> JStgExpr)
-> (FastString -> Ident) -> FastString -> JStgExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FastString -> Ident
name