module Language.Javascript.JMacro.Util where import Prelude hiding (tail, init, head, last, minimum, maximum, foldr1, foldl1, (!!), read, (<), (&&)) import qualified Prelude as P import Language.Javascript.JMacro.Base (.) :: JExpr -> String -> JExpr JExpr x . :: JExpr -> String -> JExpr . String y = JExpr -> Ident -> JExpr SelExpr JExpr x (String -> Ident StrI String y) (<>) :: (ToJExpr a) => JExpr -> a -> JExpr JExpr x <> :: JExpr -> a -> JExpr <> a y = JExpr -> JExpr -> JExpr IdxExpr JExpr x (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a y) infixl 2 =: (=:) :: ToJExpr a => JExpr -> a -> JStat JExpr x =: :: JExpr -> a -> JStat =: a y = JExpr -> JExpr -> JStat AssignStat JExpr x (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a y) ($) :: (ToJExpr a, ToJExpr b) => a -> b -> JExpr a x $ :: a -> b -> JExpr $ b y = JExpr -> [JExpr] -> JExpr ApplExpr (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) (b -> [JExpr] forall a. ToJExpr a => a -> [JExpr] toJExprList b y) ($$) :: (ToJExpr a, ToJExpr b) => a -> b -> JStat a x $$ :: a -> b -> JStat $$ b y = JExpr -> [JExpr] -> JStat ApplStat (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) (b -> [JExpr] forall a. ToJExpr a => a -> [JExpr] toJExprList b y) (==), (!=), (<), (&&) :: JExpr -> JExpr -> JExpr JExpr x == :: JExpr -> JExpr -> JExpr == JExpr y = String -> JExpr -> JExpr -> JExpr InfixExpr String "==" JExpr x JExpr y JExpr x != :: JExpr -> JExpr -> JExpr != JExpr y = String -> JExpr -> JExpr -> JExpr InfixExpr String "!=" JExpr x JExpr y infix 4 < JExpr x < :: JExpr -> JExpr -> JExpr < JExpr y = String -> JExpr -> JExpr -> JExpr InfixExpr String "<" JExpr x JExpr y infixr 3 && JExpr x && :: JExpr -> JExpr -> JExpr && JExpr y = String -> JExpr -> JExpr -> JExpr InfixExpr String "&&" JExpr x JExpr y null :: JExpr null :: JExpr null = String -> JExpr jsv String "null" new :: ToJExpr a => a -> JExpr new :: a -> JExpr new a x = JExpr -> JExpr NewExpr (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) if' :: (ToJExpr a, ToStat b) => a -> b -> JStat if' :: a -> b -> JStat if' a x b y = JExpr -> JStat -> JStat -> JStat IfStat (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) (b -> JStat forall a. ToStat a => a -> JStat toStat b y) ([JStat] -> JStat BlockStat []) ifElse :: (ToJExpr a, ToStat b, ToStat c) => a -> b -> c -> JStat ifElse :: a -> b -> c -> JStat ifElse a x b y c z = JExpr -> JStat -> JStat -> JStat IfStat (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) (b -> JStat forall a. ToStat a => a -> JStat toStat b y) (c -> JStat forall a. ToStat a => a -> JStat toStat c z) while :: ToJExpr a => a -> JStat -> JStat while :: a -> JStat -> JStat while a x JStat y = Bool -> JExpr -> JStat -> JStat WhileStat Bool False (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) JStat y return :: ToJExpr a => a -> JStat return :: a -> JStat return a x = JExpr -> JStat ReturnStat (a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x) toJExprList :: ToJExpr a => a -> [JExpr] toJExprList :: a -> [JExpr] toJExprList a x = case a -> JExpr forall a. ToJExpr a => a -> JExpr toJExpr a x of (ValExpr (JList [JExpr] l)) -> [JExpr] l JExpr x' -> [JExpr x'] jstr :: P.String -> JExpr jstr :: String -> JExpr jstr = JVal -> JExpr ValExpr (JVal -> JExpr) -> (String -> JVal) -> String -> JExpr forall b c a. (b -> c) -> (a -> b) -> a -> c P.. String -> JVal JStr