{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE PatternSynonyms #-}
module GHC.JS.Syntax
(
JStat(..)
, JExpr(..)
, JVal(..)
, JOp(..)
, JUOp(..)
, Ident(..)
, identFS
, JsLabel
, 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 PreInc
, pattern PostInc
, pattern PreDec
, pattern PostDec
, IdentSupply(..)
, newIdentSupply
, pseudoSaturate
, SaneDouble(..)
) where
import GHC.Prelude
import Control.DeepSeq
import Data.Function
import Data.Data
import Data.Word
import qualified Data.Semigroup as Semigroup
import GHC.Generics
import GHC.Data.FastString
import GHC.Utils.Monad.State.Strict
import GHC.Types.Unique
import GHC.Types.Unique.Map
newtype IdentSupply a
= IS {forall a. IdentSupply a -> State [Ident] a
runIdentSupply :: State [Ident] a}
deriving Typeable
instance NFData (IdentSupply a) where rnf :: IdentSupply a -> ()
rnf IS{} = ()
inIdentSupply :: (State [Ident] a -> State [Ident] b) -> IdentSupply a -> IdentSupply b
inIdentSupply :: forall a b.
(State [Ident] a -> State [Ident] b)
-> IdentSupply a -> IdentSupply b
inIdentSupply State [Ident] a -> State [Ident] b
f IdentSupply a
x = forall a. State [Ident] a -> IdentSupply a
IS forall a b. (a -> b) -> a -> b
$ State [Ident] a -> State [Ident] b
f (forall a. IdentSupply a -> State [Ident] a
runIdentSupply IdentSupply a
x)
instance Functor IdentSupply where
fmap :: forall a b. (a -> b) -> IdentSupply a -> IdentSupply b
fmap a -> b
f IdentSupply a
x = forall a b.
(State [Ident] a -> State [Ident] b)
-> IdentSupply a -> IdentSupply b
inIdentSupply (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) IdentSupply a
x
newIdentSupply :: Maybe FastString -> [Ident]
newIdentSupply :: Maybe FastString -> [Ident]
newIdentSupply Maybe FastString
Nothing = Maybe FastString -> [Ident]
newIdentSupply (forall a. a -> Maybe a
Just FastString
"jmId")
newIdentSupply (Just FastString
pfx) = [ FastString -> Ident
TxtI (forall a. Monoid a => [a] -> a
mconcat [FastString
pfx,FastString
"_",String -> FastString
mkFastString (forall a. Show a => a -> String
show Word64
x)])
| Word64
x <- [(Word64
0::Word64)..]
]
pseudoSaturate :: IdentSupply a -> a
pseudoSaturate :: forall a. IdentSupply a -> a
pseudoSaturate IdentSupply a
x = forall s a. State s a -> s -> a
evalState (forall a. IdentSupply a -> State [Ident] a
runIdentSupply IdentSupply a
x) forall a b. (a -> b) -> a -> b
$ Maybe FastString -> [Ident]
newIdentSupply (forall a. a -> Maybe a
Just FastString
"<<unsatId>>")
instance Eq a => Eq (IdentSupply a) where
== :: IdentSupply a -> IdentSupply a -> Bool
(==) = forall a. Eq a => a -> a -> Bool
(==) forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall a. IdentSupply a -> a
pseudoSaturate
instance Ord a => Ord (IdentSupply a) where
compare :: IdentSupply a -> IdentSupply a -> Ordering
compare = forall a. Ord a => a -> a -> Ordering
compare forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall a. IdentSupply a -> a
pseudoSaturate
instance Show a => Show (IdentSupply a) where
show :: IdentSupply a -> String
show IdentSupply a
x = String
"(" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show (forall a. IdentSupply a -> a
pseudoSaturate IdentSupply a
x) forall a. [a] -> [a] -> [a]
++ String
")"
data JStat
= DeclStat !Ident !(Maybe JExpr)
| ReturnStat JExpr
| IfStat JExpr JStat JStat
| WhileStat Bool JExpr 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)
deriving (JStat -> JStat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JStat -> JStat -> Bool
$c/= :: JStat -> JStat -> Bool
== :: JStat -> JStat -> Bool
$c== :: JStat -> JStat -> Bool
Eq, Typeable, forall x. Rep JStat x -> JStat
forall x. JStat -> Rep JStat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JStat x -> JStat
$cfrom :: forall x. JStat -> Rep JStat x
Generic)
type JsLabel = LexicalFastString
instance Semigroup JStat where
<> :: JStat -> JStat -> JStat
(<>) = JStat -> JStat -> JStat
appendJStat
instance Monoid JStat where
mempty :: JStat
mempty = [JStat] -> JStat
BlockStat []
appendJStat :: JStat -> JStat -> JStat
appendJStat :: JStat -> JStat -> JStat
appendJStat JStat
mx JStat
my = case (JStat
mx,JStat
my) of
(BlockStat [] , JStat
y ) -> JStat
y
(JStat
x , BlockStat []) -> JStat
x
(BlockStat [JStat]
xs , BlockStat [JStat]
ys) -> [JStat] -> JStat
BlockStat forall a b. (a -> b) -> a -> b
$ [JStat]
xs forall a. [a] -> [a] -> [a]
++ [JStat]
ys
(BlockStat [JStat]
xs , JStat
ys ) -> [JStat] -> JStat
BlockStat forall a b. (a -> b) -> a -> b
$ [JStat]
xs forall a. [a] -> [a] -> [a]
++ [JStat
ys]
(JStat
xs , BlockStat [JStat]
ys) -> [JStat] -> JStat
BlockStat forall a b. (a -> b) -> a -> b
$ JStat
xs forall a. a -> [a] -> [a]
: [JStat]
ys
(JStat
xs , JStat
ys ) -> [JStat] -> JStat
BlockStat [JStat
xs,JStat
ys]
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)
deriving (JExpr -> JExpr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JExpr -> JExpr -> Bool
$c/= :: JExpr -> JExpr -> Bool
== :: JExpr -> JExpr -> Bool
$c== :: JExpr -> JExpr -> Bool
Eq, Typeable, forall x. Rep JExpr x -> JExpr
forall x. JExpr -> Rep JExpr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JExpr x -> JExpr
$cfrom :: forall x. JExpr -> Rep JExpr x
Generic)
pattern New :: JExpr -> JExpr
pattern $bNew :: JExpr -> JExpr
$mNew :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
New x = UOpExpr NewOp x
pattern PreInc :: JExpr -> JExpr
pattern $bPreInc :: JExpr -> JExpr
$mPreInc :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
PreInc x = UOpExpr PreIncOp x
pattern PostInc :: JExpr -> JExpr
pattern $bPostInc :: JExpr -> JExpr
$mPostInc :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
PostInc x = UOpExpr PostIncOp x
pattern PreDec :: JExpr -> JExpr
pattern $bPreDec :: JExpr -> JExpr
$mPreDec :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
PreDec x = UOpExpr PreDecOp x
pattern PostDec :: JExpr -> JExpr
pattern $bPostDec :: JExpr -> JExpr
$mPostDec :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
PostDec x = UOpExpr PostDecOp x
pattern Not :: JExpr -> JExpr
pattern $bNot :: JExpr -> JExpr
$mNot :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
Not x = UOpExpr NotOp x
pattern Negate :: JExpr -> JExpr
pattern $bNegate :: JExpr -> JExpr
$mNegate :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
Negate x = UOpExpr NegOp x
pattern Add :: JExpr -> JExpr -> JExpr
pattern $bAdd :: JExpr -> JExpr -> JExpr
$mAdd :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
Add x y = InfixExpr AddOp x y
pattern Sub :: JExpr -> JExpr -> JExpr
pattern $bSub :: JExpr -> JExpr -> JExpr
$mSub :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
Sub x y = InfixExpr SubOp x y
pattern Mul :: JExpr -> JExpr -> JExpr
pattern $bMul :: JExpr -> JExpr -> JExpr
$mMul :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
Mul x y = InfixExpr MulOp x y
pattern Div :: JExpr -> JExpr -> JExpr
pattern $bDiv :: JExpr -> JExpr -> JExpr
$mDiv :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
Div x y = InfixExpr DivOp x y
pattern Mod :: JExpr -> JExpr -> JExpr
pattern $bMod :: JExpr -> JExpr -> JExpr
$mMod :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
Mod x y = InfixExpr ModOp x y
pattern BOr :: JExpr -> JExpr -> JExpr
pattern $bBOr :: JExpr -> JExpr -> JExpr
$mBOr :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
BOr x y = InfixExpr BOrOp x y
pattern BAnd :: JExpr -> JExpr -> JExpr
pattern $bBAnd :: JExpr -> JExpr -> JExpr
$mBAnd :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
BAnd x y = InfixExpr BAndOp x y
pattern BXor :: JExpr -> JExpr -> JExpr
pattern $bBXor :: JExpr -> JExpr -> JExpr
$mBXor :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
BXor x y = InfixExpr BXorOp x y
pattern BNot :: JExpr -> JExpr
pattern $bBNot :: JExpr -> JExpr
$mBNot :: forall {r}. JExpr -> (JExpr -> r) -> ((# #) -> r) -> r
BNot x = UOpExpr BNotOp x
pattern LOr :: JExpr -> JExpr -> JExpr
pattern $bLOr :: JExpr -> JExpr -> JExpr
$mLOr :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
LOr x y = InfixExpr LOrOp x y
pattern LAnd :: JExpr -> JExpr -> JExpr
pattern $bLAnd :: JExpr -> JExpr -> JExpr
$mLAnd :: forall {r}. JExpr -> (JExpr -> JExpr -> r) -> ((# #) -> r) -> r
LAnd x y = InfixExpr LAndOp x y
pattern Int :: Integer -> JExpr
pattern $bInt :: Integer -> JExpr
$mInt :: forall {r}. JExpr -> (Integer -> r) -> ((# #) -> r) -> r
Int x = ValExpr (JInt x)
pattern String :: FastString -> JExpr
pattern $bString :: FastString -> JExpr
$mString :: forall {r}. JExpr -> (FastString -> r) -> ((# #) -> r) -> r
String x = ValExpr (JStr x)
data JVal
= JVar Ident
| JList [JExpr]
| JDouble SaneDouble
| JInt Integer
| JStr FastString
| JRegEx FastString
| JHash (UniqMap FastString JExpr)
| JFunc [Ident] JStat
| UnsatVal (IdentSupply JVal)
deriving (JVal -> JVal -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JVal -> JVal -> Bool
$c/= :: JVal -> JVal -> Bool
== :: JVal -> JVal -> Bool
$c== :: JVal -> JVal -> Bool
Eq, Typeable, 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
$cto :: forall x. Rep JVal x -> JVal
$cfrom :: forall x. JVal -> Rep JVal x
Generic)
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
deriving (Int -> JOp -> ShowS
[JOp] -> ShowS
JOp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JOp] -> ShowS
$cshowList :: [JOp] -> ShowS
show :: JOp -> String
$cshow :: JOp -> String
showsPrec :: Int -> JOp -> ShowS
$cshowsPrec :: Int -> JOp -> ShowS
Show, JOp -> JOp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JOp -> JOp -> Bool
$c/= :: JOp -> JOp -> Bool
== :: JOp -> JOp -> Bool
$c== :: JOp -> JOp -> Bool
Eq, Eq JOp
JOp -> JOp -> Bool
JOp -> JOp -> Ordering
JOp -> JOp -> JOp
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
min :: JOp -> JOp -> JOp
$cmin :: JOp -> JOp -> JOp
max :: JOp -> JOp -> JOp
$cmax :: JOp -> JOp -> JOp
>= :: JOp -> JOp -> Bool
$c>= :: JOp -> JOp -> Bool
> :: JOp -> JOp -> Bool
$c> :: JOp -> JOp -> Bool
<= :: JOp -> JOp -> Bool
$c<= :: JOp -> JOp -> Bool
< :: JOp -> JOp -> Bool
$c< :: JOp -> JOp -> Bool
compare :: JOp -> JOp -> Ordering
$ccompare :: JOp -> JOp -> Ordering
Ord, Int -> JOp
JOp -> Int
JOp -> [JOp]
JOp -> JOp
JOp -> JOp -> [JOp]
JOp -> JOp -> JOp -> [JOp]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: JOp -> JOp -> JOp -> [JOp]
$cenumFromThenTo :: JOp -> JOp -> JOp -> [JOp]
enumFromTo :: JOp -> JOp -> [JOp]
$cenumFromTo :: JOp -> JOp -> [JOp]
enumFromThen :: JOp -> JOp -> [JOp]
$cenumFromThen :: JOp -> JOp -> [JOp]
enumFrom :: JOp -> [JOp]
$cenumFrom :: JOp -> [JOp]
fromEnum :: JOp -> Int
$cfromEnum :: JOp -> Int
toEnum :: Int -> JOp
$ctoEnum :: Int -> JOp
pred :: JOp -> JOp
$cpred :: JOp -> JOp
succ :: JOp -> JOp
$csucc :: JOp -> JOp
Enum, Typeable JOp
JOp -> DataType
JOp -> Constr
(forall b. Data b => b -> b) -> JOp -> JOp
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) -> JOp -> u
forall u. (forall d. Data d => d -> u) -> JOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JOp -> c JOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JOp)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JOp -> m JOp
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JOp -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> JOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JOp -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JOp -> r
gmapT :: (forall b. Data b => b -> b) -> JOp -> JOp
$cgmapT :: (forall b. Data b => b -> b) -> JOp -> JOp
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JOp)
dataTypeOf :: JOp -> DataType
$cdataTypeOf :: JOp -> DataType
toConstr :: JOp -> Constr
$ctoConstr :: JOp -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JOp -> c JOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JOp -> c JOp
Data, Typeable, forall x. Rep JOp x -> JOp
forall x. JOp -> Rep JOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JOp x -> JOp
$cfrom :: forall x. JOp -> Rep JOp x
Generic)
instance NFData JOp
data JUOp
= NotOp
| BNotOp
| NegOp
| PlusOp
| NewOp
| TypeofOp
| DeleteOp
| YieldOp
| VoidOp
| PreIncOp
| PostIncOp
| PreDecOp
| PostDecOp
deriving (Int -> JUOp -> ShowS
[JUOp] -> ShowS
JUOp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JUOp] -> ShowS
$cshowList :: [JUOp] -> ShowS
show :: JUOp -> String
$cshow :: JUOp -> String
showsPrec :: Int -> JUOp -> ShowS
$cshowsPrec :: Int -> JUOp -> ShowS
Show, JUOp -> JUOp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JUOp -> JUOp -> Bool
$c/= :: JUOp -> JUOp -> Bool
== :: JUOp -> JUOp -> Bool
$c== :: JUOp -> JUOp -> Bool
Eq, Eq JUOp
JUOp -> JUOp -> Bool
JUOp -> JUOp -> Ordering
JUOp -> JUOp -> JUOp
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
min :: JUOp -> JUOp -> JUOp
$cmin :: JUOp -> JUOp -> JUOp
max :: JUOp -> JUOp -> JUOp
$cmax :: JUOp -> JUOp -> JUOp
>= :: JUOp -> JUOp -> Bool
$c>= :: JUOp -> JUOp -> Bool
> :: JUOp -> JUOp -> Bool
$c> :: JUOp -> JUOp -> Bool
<= :: JUOp -> JUOp -> Bool
$c<= :: JUOp -> JUOp -> Bool
< :: JUOp -> JUOp -> Bool
$c< :: JUOp -> JUOp -> Bool
compare :: JUOp -> JUOp -> Ordering
$ccompare :: JUOp -> JUOp -> Ordering
Ord, Int -> JUOp
JUOp -> Int
JUOp -> [JUOp]
JUOp -> JUOp
JUOp -> JUOp -> [JUOp]
JUOp -> JUOp -> JUOp -> [JUOp]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: JUOp -> JUOp -> JUOp -> [JUOp]
$cenumFromThenTo :: JUOp -> JUOp -> JUOp -> [JUOp]
enumFromTo :: JUOp -> JUOp -> [JUOp]
$cenumFromTo :: JUOp -> JUOp -> [JUOp]
enumFromThen :: JUOp -> JUOp -> [JUOp]
$cenumFromThen :: JUOp -> JUOp -> [JUOp]
enumFrom :: JUOp -> [JUOp]
$cenumFrom :: JUOp -> [JUOp]
fromEnum :: JUOp -> Int
$cfromEnum :: JUOp -> Int
toEnum :: Int -> JUOp
$ctoEnum :: Int -> JUOp
pred :: JUOp -> JUOp
$cpred :: JUOp -> JUOp
succ :: JUOp -> JUOp
$csucc :: JUOp -> JUOp
Enum, Typeable JUOp
JUOp -> DataType
JUOp -> Constr
(forall b. Data b => b -> b) -> JUOp -> JUOp
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) -> JUOp -> u
forall u. (forall d. Data d => d -> u) -> JUOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JUOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JUOp -> c JUOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JUOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JUOp)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JUOp -> m JUOp
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JUOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JUOp -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> JUOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JUOp -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JUOp -> r
gmapT :: (forall b. Data b => b -> b) -> JUOp -> JUOp
$cgmapT :: (forall b. Data b => b -> b) -> JUOp -> JUOp
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JUOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JUOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JUOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JUOp)
dataTypeOf :: JUOp -> DataType
$cdataTypeOf :: JUOp -> DataType
toConstr :: JUOp -> Constr
$ctoConstr :: JUOp -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JUOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JUOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JUOp -> c JUOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JUOp -> c JUOp
Data, Typeable, forall x. Rep JUOp x -> JUOp
forall x. JUOp -> Rep JUOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JUOp x -> JUOp
$cfrom :: forall x. JUOp -> Rep JUOp x
Generic)
instance NFData JUOp
newtype SaneDouble = SaneDouble
{ SaneDouble -> Double
unSaneDouble :: Double
}
deriving (Typeable SaneDouble
SaneDouble -> DataType
SaneDouble -> Constr
(forall b. Data b => b -> b) -> SaneDouble -> SaneDouble
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) -> SaneDouble -> u
forall u. (forall d. Data d => d -> u) -> SaneDouble -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SaneDouble
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SaneDouble -> c SaneDouble
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SaneDouble)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SaneDouble)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SaneDouble -> m SaneDouble
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SaneDouble -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SaneDouble -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> SaneDouble -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SaneDouble -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SaneDouble -> r
gmapT :: (forall b. Data b => b -> b) -> SaneDouble -> SaneDouble
$cgmapT :: (forall b. Data b => b -> b) -> SaneDouble -> SaneDouble
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SaneDouble)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SaneDouble)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SaneDouble)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SaneDouble)
dataTypeOf :: SaneDouble -> DataType
$cdataTypeOf :: SaneDouble -> DataType
toConstr :: SaneDouble -> Constr
$ctoConstr :: SaneDouble -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SaneDouble
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SaneDouble
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SaneDouble -> c SaneDouble
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SaneDouble -> c SaneDouble
Data, Typeable, Num SaneDouble
Rational -> SaneDouble
SaneDouble -> SaneDouble
SaneDouble -> SaneDouble -> SaneDouble
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
fromRational :: Rational -> SaneDouble
$cfromRational :: Rational -> SaneDouble
recip :: SaneDouble -> SaneDouble
$crecip :: SaneDouble -> SaneDouble
/ :: SaneDouble -> SaneDouble -> SaneDouble
$c/ :: SaneDouble -> SaneDouble -> SaneDouble
Fractional, Integer -> SaneDouble
SaneDouble -> SaneDouble
SaneDouble -> SaneDouble -> SaneDouble
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> SaneDouble
$cfromInteger :: Integer -> SaneDouble
signum :: SaneDouble -> SaneDouble
$csignum :: SaneDouble -> SaneDouble
abs :: SaneDouble -> SaneDouble
$cabs :: SaneDouble -> SaneDouble
negate :: SaneDouble -> SaneDouble
$cnegate :: SaneDouble -> SaneDouble
* :: SaneDouble -> SaneDouble -> SaneDouble
$c* :: SaneDouble -> SaneDouble -> SaneDouble
- :: SaneDouble -> SaneDouble -> SaneDouble
$c- :: SaneDouble -> SaneDouble -> SaneDouble
+ :: SaneDouble -> SaneDouble -> SaneDouble
$c+ :: SaneDouble -> SaneDouble -> SaneDouble
Num, forall x. Rep SaneDouble x -> SaneDouble
forall x. SaneDouble -> Rep SaneDouble x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SaneDouble x -> SaneDouble
$cfrom :: forall x. SaneDouble -> Rep SaneDouble x
Generic, SaneDouble -> ()
forall a. (a -> ()) -> NFData a
rnf :: SaneDouble -> ()
$crnf :: SaneDouble -> ()
NFData)
instance Eq SaneDouble where
(SaneDouble Double
x) == :: SaneDouble -> SaneDouble -> Bool
== (SaneDouble Double
y) = Double
x forall a. Eq a => a -> a -> Bool
== Double
y Bool -> Bool -> Bool
|| (forall a. RealFloat a => a -> Bool
isNaN Double
x Bool -> Bool -> Bool
&& forall a. RealFloat a => a -> Bool
isNaN Double
y)
instance Ord SaneDouble where
compare :: SaneDouble -> SaneDouble -> Ordering
compare (SaneDouble Double
x) (SaneDouble Double
y) = forall a. Ord a => a -> a -> Ordering
compare (forall {a}. RealFloat a => a -> Maybe a
fromNaN Double
x) (forall {a}. RealFloat a => a -> Maybe a
fromNaN Double
y)
where fromNaN :: a -> Maybe a
fromNaN a
z | forall a. RealFloat a => a -> Bool
isNaN a
z = forall a. Maybe a
Nothing
| Bool
otherwise = forall a. a -> Maybe a
Just a
z
instance Show SaneDouble where
show :: SaneDouble -> String
show (SaneDouble Double
x) = forall a. Show a => a -> String
show Double
x
newtype Ident = TxtI { Ident -> FastString
itxt :: FastString }
deriving stock (Int -> Ident -> ShowS
[Ident] -> ShowS
Ident -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ident] -> ShowS
$cshowList :: [Ident] -> ShowS
show :: Ident -> String
$cshow :: Ident -> String
showsPrec :: Int -> Ident -> ShowS
$cshowsPrec :: Int -> Ident -> ShowS
Show, Ident -> Ident -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ident -> Ident -> Bool
$c/= :: Ident -> Ident -> Bool
== :: Ident -> Ident -> Bool
$c== :: Ident -> Ident -> Bool
Eq)
deriving newtype (Ident -> Unique
forall a. (a -> Unique) -> Uniquable a
getUnique :: Ident -> Unique
$cgetUnique :: Ident -> Unique
Uniquable)
identFS :: Ident -> FastString
identFS :: Ident -> FastString
identFS = \case
TxtI FastString
fs -> FastString
fs