{-# LANGUAGE TypeFamilies, Rank2Types #-}

-- Performs code analysis on the GOOL code
module GOOL.Drasil.CodeInfo (CodeInfo(..)) where

import GOOL.Drasil.ClassInterface (MSBody, VSType, SValue, MSStatement, 
  SMethod, OOProg, ProgramSym(..), FileSym(..), PermanenceSym(..), BodySym(..),
  BlockSym(..), TypeSym(..), TypeElim(..), VariableSym(..), VariableElim(..),
  ValueSym(..), Argument(..), Literal(..), MathConstant(..), VariableValue(..),
  CommandLineArgs(..), NumericExpression(..), BooleanExpression(..),
  Comparison(..), ValueExpression(..), InternalValueExp(..), FunctionSym(..),
  GetSet(..), List(..), InternalList(..), ThunkSym(..), VectorType(..),
  VectorDecl(..), VectorThunk(..), VectorExpression(..), ThunkAssign(..),
  StatementSym(..), AssignStatement(..), DeclStatement(..), IOStatement(..),
  StringStatement(..), FuncAppStatement(..), CommentStatement(..),
  ControlStatement(..), StatePattern(..), ObserverPattern(..),
  StrategyPattern(..), ScopeSym(..), ParameterSym(..), MethodSym(..),
  StateVarSym(..), ClassSym(..), ModuleSym(..))
import GOOL.Drasil.CodeType (CodeType(Void))
import GOOL.Drasil.AST (ScopeTag(..), qualName)
import GOOL.Drasil.CodeAnalysis (ExceptionType(..))
import GOOL.Drasil.Helpers (toCode, toState)
import GOOL.Drasil.State (GOOLState, VS, lensGStoFS, lensFStoCS, lensFStoMS,
  lensCStoMS, lensMStoVS, lensVStoFS, lensCStoFS, modifyReturn, 
  setClassName, getClassName, setModuleName, getModuleName, addClass, 
  updateClassMap, addException, updateMethodExcMap, updateCallMap, addCall, 
  callMapTransClosure, updateMEMWithCalls)

import Control.Monad.State (State, modify)
import qualified Control.Monad.State as S (get)
import Control.Lens.Zoom (zoom)
import Data.Maybe (fromMaybe)

newtype CodeInfo a = CI {forall a. CodeInfo a -> a
unCI :: a} deriving CodeInfo a -> CodeInfo a -> Bool
forall a. Eq a => CodeInfo a -> CodeInfo a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeInfo a -> CodeInfo a -> Bool
$c/= :: forall a. Eq a => CodeInfo a -> CodeInfo a -> Bool
== :: CodeInfo a -> CodeInfo a -> Bool
$c== :: forall a. Eq a => CodeInfo a -> CodeInfo a -> Bool
Eq

-- FIXME: Use DerivingVia language extension (and maybe DeriveFunctor) to 
-- derive the Functor, Applicative, Monad instances for this 
-- (and for JavaCode, PythonCode, etc.)
instance Functor CodeInfo where
  fmap :: forall a b. (a -> b) -> CodeInfo a -> CodeInfo b
fmap a -> b
f (CI a
x) = forall a. a -> CodeInfo a
CI (a -> b
f a
x)

instance Applicative CodeInfo where
  pure :: forall a. a -> CodeInfo a
pure = forall a. a -> CodeInfo a
CI
  (CI a -> b
f) <*> :: forall a b. CodeInfo (a -> b) -> CodeInfo a -> CodeInfo b
<*> (CI a
x) = forall a. a -> CodeInfo a
CI (a -> b
f a
x)

instance Monad CodeInfo where
  CI a
x >>= :: forall a b. CodeInfo a -> (a -> CodeInfo b) -> CodeInfo b
>>= a -> CodeInfo b
f = a -> CodeInfo b
f a
x

instance OOProg CodeInfo where

instance ProgramSym CodeInfo where
  type Program CodeInfo = GOOLState
  prog :: String -> String -> [SFile CodeInfo] -> GSProgram CodeInfo
prog String
_ String
_ [SFile CodeInfo]
fs = do
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' GOOLState FileState
lensGStoFS) [SFile CodeInfo]
fs
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (GOOLState -> GOOLState
updateMEMWithCalls forall b c a. (b -> c) -> (a -> b) -> a -> c
. GOOLState -> GOOLState
callMapTransClosure)
    GOOLState
s <- forall s (m :: * -> *). MonadState s m => m s
S.get
    forall a s. a -> State s a
toState forall a b. (a -> b) -> a -> b
$ forall (r :: * -> *) a. Monad r => a -> r a
toCode GOOLState
s

instance FileSym CodeInfo where
  type File CodeInfo = ()
  fileDoc :: FSModule CodeInfo -> SFile CodeInfo
fileDoc = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  
  docMod :: String -> [String] -> String -> SFile CodeInfo -> SFile CodeInfo
docMod String
_ [String]
_ String
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

instance PermanenceSym CodeInfo where
  type Permanence CodeInfo = ()
  static :: CodeInfo (Permanence CodeInfo)
static  = forall (r :: * -> *) a. Monad r => a -> r a
toCode ()
  dynamic :: CodeInfo (Permanence CodeInfo)
dynamic = forall (r :: * -> *) a. Monad r => a -> r a
toCode ()

instance BodySym CodeInfo where
  type Body CodeInfo = ()
  body :: [MSBlock CodeInfo] -> MSBody CodeInfo
body = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList

  addComments :: String -> MSBody CodeInfo -> MSBody CodeInfo
addComments String
_ MSBody CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo

instance BlockSym CodeInfo where
  type Block CodeInfo = ()
  block :: [MSStatement CodeInfo] -> MSBlock CodeInfo
block = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList

instance TypeSym CodeInfo where
  type Type CodeInfo = String
  bool :: VSType CodeInfo
bool              = forall s. State s (CodeInfo String)
noInfoType
  int :: VSType CodeInfo
int               = forall s. State s (CodeInfo String)
noInfoType
  float :: VSType CodeInfo
float             = forall s. State s (CodeInfo String)
noInfoType
  double :: VSType CodeInfo
double            = forall s. State s (CodeInfo String)
noInfoType
  char :: VSType CodeInfo
char              = forall s. State s (CodeInfo String)
noInfoType
  string :: VSType CodeInfo
string            = forall s. State s (CodeInfo String)
noInfoType
  infile :: VSType CodeInfo
infile            = forall s. State s (CodeInfo String)
noInfoType
  outfile :: VSType CodeInfo
outfile           = forall s. State s (CodeInfo String)
noInfoType
  listType :: VSType CodeInfo -> VSType CodeInfo
listType      VSType CodeInfo
_   = forall s. State s (CodeInfo String)
noInfoType
  arrayType :: VSType CodeInfo -> VSType CodeInfo
arrayType     VSType CodeInfo
_   = forall s. State s (CodeInfo String)
noInfoType
  listInnerType :: VSType CodeInfo -> VSType CodeInfo
listInnerType VSType CodeInfo
_   = forall s. State s (CodeInfo String)
noInfoType
  obj :: String -> VSType CodeInfo
obj               = forall a s. a -> State s a
toState forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (r :: * -> *) a. Monad r => a -> r a
toCode
  funcType :: [VSType CodeInfo] -> VSType CodeInfo -> VSType CodeInfo
funcType      [VSType CodeInfo]
_ VSType CodeInfo
_ = forall s. State s (CodeInfo String)
noInfoType
  void :: VSType CodeInfo
void              = forall s. State s (CodeInfo String)
noInfoType

instance TypeElim CodeInfo where
  getType :: CodeInfo (Type CodeInfo) -> CodeType
getType CodeInfo (Type CodeInfo)
_     = CodeType
Void
  getTypeString :: CodeInfo (Type CodeInfo) -> String
getTypeString = forall a. CodeInfo a -> a
unCI

instance VariableSym CodeInfo where
  type Variable CodeInfo = ()
  var :: String -> VSType CodeInfo -> SVariable CodeInfo
var         String
_ VSType CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  staticVar :: String -> VSType CodeInfo -> SVariable CodeInfo
staticVar   String
_ VSType CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  constant :: String -> VSType CodeInfo -> SVariable CodeInfo
constant    String
_ VSType CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  extVar :: String -> String -> VSType CodeInfo -> SVariable CodeInfo
extVar      String
_ String
_ VSType CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  self :: SVariable CodeInfo
self              = forall s. State s (CodeInfo ())
noInfo
  classVar :: VSType CodeInfo -> SVariable CodeInfo -> SVariable CodeInfo
classVar    VSType CodeInfo
_ SVariable CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  extClassVar :: VSType CodeInfo -> SVariable CodeInfo -> SVariable CodeInfo
extClassVar VSType CodeInfo
_ SVariable CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  objVar :: SVariable CodeInfo -> SVariable CodeInfo -> SVariable CodeInfo
objVar      SVariable CodeInfo
_ SVariable CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  objVarSelf :: SVariable CodeInfo -> SVariable CodeInfo
objVarSelf  SVariable CodeInfo
_     = forall s. State s (CodeInfo ())
noInfo
  arrayElem :: Integer -> SVariable CodeInfo -> SVariable CodeInfo
arrayElem   Integer
_ SVariable CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  
instance VariableElim CodeInfo where
  variableName :: CodeInfo (Variable CodeInfo) -> String
variableName CodeInfo (Variable CodeInfo)
_ = String
""
  variableType :: CodeInfo (Variable CodeInfo) -> CodeInfo (Type CodeInfo)
variableType CodeInfo (Variable CodeInfo)
_ = forall (r :: * -> *) a. Monad r => a -> r a
toCode String
""

instance ValueSym CodeInfo where
  type Value CodeInfo = ()
  valueType :: CodeInfo (Value CodeInfo) -> CodeInfo (Type CodeInfo)
valueType CodeInfo (Value CodeInfo)
_ = forall (r :: * -> *) a. Monad r => a -> r a
toCode String
""

instance Argument CodeInfo where
  pointerArg :: SValue CodeInfo -> SValue CodeInfo
pointerArg = forall a. a -> a
id

instance Literal CodeInfo where
  litTrue :: SValue CodeInfo
litTrue     = forall s. State s (CodeInfo ())
noInfo
  litFalse :: SValue CodeInfo
litFalse    = forall s. State s (CodeInfo ())
noInfo
  litChar :: Char -> SValue CodeInfo
litChar   Char
_ = forall s. State s (CodeInfo ())
noInfo
  litDouble :: Double -> SValue CodeInfo
litDouble Double
_ = forall s. State s (CodeInfo ())
noInfo
  litFloat :: Float -> SValue CodeInfo
litFloat  Float
_ = forall s. State s (CodeInfo ())
noInfo
  litInt :: Integer -> SValue CodeInfo
litInt    Integer
_ = forall s. State s (CodeInfo ())
noInfo
  litString :: String -> SValue CodeInfo
litString String
_ = forall s. State s (CodeInfo ())
noInfo
  litArray :: VSType CodeInfo -> [SValue CodeInfo] -> SValue CodeInfo
litArray  VSType CodeInfo
_ = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  litList :: VSType CodeInfo -> [SValue CodeInfo] -> SValue CodeInfo
litList   VSType CodeInfo
_ = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList

instance MathConstant CodeInfo where
  pi :: SValue CodeInfo
pi = forall s. State s (CodeInfo ())
noInfo

instance VariableValue CodeInfo where
  valueOf :: SVariable CodeInfo -> SValue CodeInfo
valueOf SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo

instance CommandLineArgs CodeInfo where
  arg :: Integer -> SValue CodeInfo
arg       Integer
_ = forall s. State s (CodeInfo ())
noInfo
  argsList :: SValue CodeInfo
argsList    = forall s. State s (CodeInfo ())
noInfo
  argExists :: Integer -> SValue CodeInfo
argExists Integer
_ = forall s. State s (CodeInfo ())
noInfo

instance NumericExpression CodeInfo where
  #~ :: SValue CodeInfo -> SValue CodeInfo
(#~)  = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  #/^ :: SValue CodeInfo -> SValue CodeInfo
(#/^) = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  #| :: SValue CodeInfo -> SValue CodeInfo
(#|)  = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  #+ :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#+)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  #- :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#-)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  #* :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#*)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  #/ :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#/)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  #% :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#%)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  #^ :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(#^)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2

  log :: SValue CodeInfo -> SValue CodeInfo
log    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  ln :: SValue CodeInfo -> SValue CodeInfo
ln     = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  exp :: SValue CodeInfo -> SValue CodeInfo
exp    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  sin :: SValue CodeInfo -> SValue CodeInfo
sin    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  cos :: SValue CodeInfo -> SValue CodeInfo
cos    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  tan :: SValue CodeInfo -> SValue CodeInfo
tan    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  csc :: SValue CodeInfo -> SValue CodeInfo
csc    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  sec :: SValue CodeInfo -> SValue CodeInfo
sec    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  cot :: SValue CodeInfo -> SValue CodeInfo
cot    = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  arcsin :: SValue CodeInfo -> SValue CodeInfo
arcsin = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  arccos :: SValue CodeInfo -> SValue CodeInfo
arccos = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  arctan :: SValue CodeInfo -> SValue CodeInfo
arctan = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  floor :: SValue CodeInfo -> SValue CodeInfo
floor  = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  ceil :: SValue CodeInfo -> SValue CodeInfo
ceil   = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

instance BooleanExpression CodeInfo where
  ?! :: SValue CodeInfo -> SValue CodeInfo
(?!)  = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  ?&& :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?&&) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?|| :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?||) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2

instance Comparison CodeInfo where
  ?< :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?<)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?<= :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?<=) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?> :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?>)  = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?>= :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?>=) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?== :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?==) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  ?!= :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
(?!=) = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
    
instance ValueExpression CodeInfo where
  inlineIf :: SValue CodeInfo
-> SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
inlineIf = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3
  funcAppMixedArgs :: MixedCall CodeInfo
funcAppMixedArgs String
n VSType CodeInfo
_ = String
-> [VS (CodeInfo ())]
-> [(VS (CodeInfo ()), VS (CodeInfo ()))]
-> VS (CodeInfo ())
currModCall String
n
  selfFuncAppMixedArgs :: MixedCall CodeInfo
selfFuncAppMixedArgs = forall (r :: * -> *). ValueExpression r => MixedCall r
funcAppMixedArgs
  extFuncAppMixedArgs :: String -> MixedCall CodeInfo
extFuncAppMixedArgs String
l String
n VSType CodeInfo
_ [SValue CodeInfo]
vs NamedArgs CodeInfo
ns = do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    forall a.
[(State a (CodeInfo ()), State a (CodeInfo ()))]
-> State a (CodeInfo ())
executePairList NamedArgs CodeInfo
ns
    String -> String -> SValue CodeInfo
addExternalCall String
l String
n  
  libFuncAppMixedArgs :: String -> MixedCall CodeInfo
libFuncAppMixedArgs = forall (r :: * -> *). ValueExpression r => String -> MixedCall r
extFuncAppMixedArgs
  newObjMixedArgs :: MixedCtorCall CodeInfo
newObjMixedArgs VSType CodeInfo
ot [SValue CodeInfo]
vs NamedArgs CodeInfo
ns = do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    forall a.
[(State a (CodeInfo ()), State a (CodeInfo ()))]
-> State a (CodeInfo ())
executePairList NamedArgs CodeInfo
ns
    VSType CodeInfo -> SValue CodeInfo
addCurrModConstructorCall VSType CodeInfo
ot
  extNewObjMixedArgs :: MixedCall CodeInfo
extNewObjMixedArgs String
l VSType CodeInfo
ot [SValue CodeInfo]
vs NamedArgs CodeInfo
ns = do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    forall a.
[(State a (CodeInfo ()), State a (CodeInfo ()))]
-> State a (CodeInfo ())
executePairList NamedArgs CodeInfo
ns
    String -> VSType CodeInfo -> SValue CodeInfo
addExternalConstructorCall String
l VSType CodeInfo
ot
  libNewObjMixedArgs :: MixedCall CodeInfo
libNewObjMixedArgs = forall (r :: * -> *). ValueExpression r => MixedCall r
extNewObjMixedArgs

  lambda :: [SVariable CodeInfo] -> SValue CodeInfo -> SValue CodeInfo
lambda [SVariable CodeInfo]
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

  notNull :: SValue CodeInfo -> SValue CodeInfo
notNull = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  
instance InternalValueExp CodeInfo where
  objMethodCallMixedArgs' :: String
-> VSType CodeInfo
-> SValue CodeInfo
-> [SValue CodeInfo]
-> NamedArgs CodeInfo
-> SValue CodeInfo
objMethodCallMixedArgs' String
n VSType CodeInfo
_ SValue CodeInfo
v [SValue CodeInfo]
vs NamedArgs CodeInfo
ns = SValue CodeInfo
v forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String
-> [VS (CodeInfo ())]
-> [(VS (CodeInfo ()), VS (CodeInfo ()))]
-> VS (CodeInfo ())
currModCall String
n [SValue CodeInfo]
vs NamedArgs CodeInfo
ns

instance FunctionSym CodeInfo where
  type Function CodeInfo = ()
  func :: String
-> VSType CodeInfo -> [SValue CodeInfo] -> VSFunction CodeInfo
func  String
_ VSType CodeInfo
_ = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  objAccess :: SValue CodeInfo -> VSFunction CodeInfo -> SValue CodeInfo
objAccess = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  
instance GetSet CodeInfo where
  get :: SValue CodeInfo -> SVariable CodeInfo -> SValue CodeInfo
get SValue CodeInfo
v SVariable CodeInfo
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 SValue CodeInfo
v
  set :: SValue CodeInfo
-> SVariable CodeInfo -> SValue CodeInfo -> SValue CodeInfo
set SValue CodeInfo
v SVariable CodeInfo
_ = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 SValue CodeInfo
v

instance List CodeInfo where
  listSize :: SValue CodeInfo -> SValue CodeInfo
listSize   = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  listAdd :: SValue CodeInfo
-> SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
listAdd    = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3
  listAppend :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
listAppend = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  listAccess :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
listAccess = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  listSet :: SValue CodeInfo
-> SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
listSet    = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3
  indexOf :: SValue CodeInfo -> SValue CodeInfo -> SValue CodeInfo
indexOf    = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  
instance InternalList CodeInfo where
  listSlice' :: Maybe (SValue CodeInfo)
-> Maybe (SValue CodeInfo)
-> Maybe (SValue CodeInfo)
-> SVariable CodeInfo
-> SValue CodeInfo
-> MSBlock CodeInfo
listSlice' Maybe (SValue CodeInfo)
b Maybe (SValue CodeInfo)
e Maybe (SValue CodeInfo)
s SVariable CodeInfo
_ SValue CodeInfo
vl = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ do
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall a. a -> Maybe a -> a
fromMaybe forall s. State s (CodeInfo ())
noInfo) [Maybe (SValue CodeInfo)
b,Maybe (SValue CodeInfo)
e,Maybe (SValue CodeInfo)
s]
    CodeInfo ()
_ <- SValue CodeInfo
vl
    forall s. State s (CodeInfo ())
noInfo

instance ThunkSym CodeInfo where
  type Thunk CodeInfo = ()

instance ThunkAssign CodeInfo where
  thunkAssign :: SVariable CodeInfo -> VSThunk CodeInfo -> MSStatement CodeInfo
thunkAssign SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

instance VectorType CodeInfo where
  vecType :: VSType CodeInfo -> VSType CodeInfo
vecType VSType CodeInfo
_ = forall s. State s (CodeInfo String)
noInfoType

instance VectorDecl CodeInfo where
  vecDec :: Integer -> SVariable CodeInfo -> MSStatement CodeInfo
vecDec Integer
_ SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  vecDecDef :: SVariable CodeInfo -> [SValue CodeInfo] -> MSStatement CodeInfo
vecDecDef SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList

instance VectorThunk CodeInfo where
  vecThunk :: SVariable CodeInfo -> VSThunk CodeInfo
vecThunk SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo

instance VectorExpression CodeInfo where
  vecScale :: SValue CodeInfo -> VSThunk CodeInfo -> VSThunk CodeInfo
vecScale = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  vecAdd :: VSThunk CodeInfo -> VSThunk CodeInfo -> VSThunk CodeInfo
vecAdd = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  vecIndex :: SValue CodeInfo -> VSThunk CodeInfo -> SValue CodeInfo
vecIndex = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2
  vecDot :: VSThunk CodeInfo -> VSThunk CodeInfo -> VSThunk CodeInfo
vecDot = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2

instance StatementSym CodeInfo where
  type Statement CodeInfo = ()
  valStmt :: SValue CodeInfo -> MSStatement CodeInfo
valStmt = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  multi :: [MSStatement CodeInfo] -> MSStatement CodeInfo
multi    = forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  
instance AssignStatement CodeInfo where
  assign :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
assign SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  &-= :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
(&-=)  SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  &+= :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
(&+=)  SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  &++ :: SVariable CodeInfo -> MSStatement CodeInfo
(&++)  SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  &-- :: SVariable CodeInfo -> MSStatement CodeInfo
(&--)  SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo

instance DeclStatement CodeInfo where
  varDec :: SVariable CodeInfo -> MSStatement CodeInfo
varDec                 SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  varDecDef :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
varDecDef              SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  listDec :: Integer -> SVariable CodeInfo -> MSStatement CodeInfo
listDec              Integer
_ SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  listDecDef :: SVariable CodeInfo -> [SValue CodeInfo] -> MSStatement CodeInfo
listDecDef             SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  arrayDec :: Integer -> SVariable CodeInfo -> MSStatement CodeInfo
arrayDec             Integer
_ SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  arrayDecDef :: SVariable CodeInfo -> [SValue CodeInfo] -> MSStatement CodeInfo
arrayDecDef            SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  objDecDef :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
objDecDef              SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  objDecNew :: SVariable CodeInfo -> [SValue CodeInfo] -> MSStatement CodeInfo
objDecNew              SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  extObjDecNew :: String
-> SVariable CodeInfo -> [SValue CodeInfo] -> MSStatement CodeInfo
extObjDecNew         String
_ SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList
  constDecDef :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
constDecDef            SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  funcDecDef :: SVariable CodeInfo
-> [SVariable CodeInfo] -> MSBody CodeInfo -> MSStatement CodeInfo
funcDecDef           SVariable CodeInfo
_ [SVariable CodeInfo]
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

instance IOStatement CodeInfo where
  print :: SValue CodeInfo -> MSStatement CodeInfo
print        = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  printLn :: SValue CodeInfo -> MSStatement CodeInfo
printLn      = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  printStr :: String -> MSStatement CodeInfo
printStr   String
_ = forall s. State s (CodeInfo ())
noInfo
  printStrLn :: String -> MSStatement CodeInfo
printStrLn String
_ = forall s. State s (CodeInfo ())
noInfo

  printFile :: SValue CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
printFile      SValue CodeInfo
v   = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 SValue CodeInfo
v
  printFileLn :: SValue CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
printFileLn    SValue CodeInfo
v   = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 SValue CodeInfo
v
  printFileStr :: SValue CodeInfo -> String -> MSStatement CodeInfo
printFileStr   SValue CodeInfo
v String
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 SValue CodeInfo
v
  printFileStrLn :: SValue CodeInfo -> String -> MSStatement CodeInfo
printFileStrLn SValue CodeInfo
v String
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 SValue CodeInfo
v

  getInput :: SVariable CodeInfo -> MSStatement CodeInfo
getInput       SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  discardInput :: MSStatement CodeInfo
discardInput     = forall s. State s (CodeInfo ())
noInfo
  getFileInput :: SValue CodeInfo -> SVariable CodeInfo -> MSStatement CodeInfo
getFileInput SValue CodeInfo
v SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 SValue CodeInfo
v
  discardFileInput :: SValue CodeInfo -> MSStatement CodeInfo
discardFileInput = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

  openFileR :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
openFileR SVariable CodeInfo
_ SValue CodeInfo
v = forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (ExceptionType -> MethodState -> MethodState
addException ExceptionType
FileNotFound) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> 
    forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)
  openFileW :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
openFileW SVariable CodeInfo
_ SValue CodeInfo
v = forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (ExceptionType -> MethodState -> MethodState
addException ExceptionType
IO) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)
  openFileA :: SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
openFileA SVariable CodeInfo
_ SValue CodeInfo
v = forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (ExceptionType -> MethodState -> MethodState
addException ExceptionType
IO) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)
  closeFile :: SValue CodeInfo -> MSStatement CodeInfo
closeFile     = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

  getFileInputLine :: SValue CodeInfo -> SVariable CodeInfo -> MSStatement CodeInfo
getFileInputLine SValue CodeInfo
v SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 SValue CodeInfo
v
  discardFileLine :: SValue CodeInfo -> MSStatement CodeInfo
discardFileLine      = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  getFileInputAll :: SValue CodeInfo -> SVariable CodeInfo -> MSStatement CodeInfo
getFileInputAll  SValue CodeInfo
v SVariable CodeInfo
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)

instance StringStatement CodeInfo where
  stringSplit :: Char
-> SVariable CodeInfo -> SValue CodeInfo -> MSStatement CodeInfo
stringSplit Char
_ SVariable CodeInfo
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

  stringListVals :: [SVariable CodeInfo] -> SValue CodeInfo -> MSStatement CodeInfo
stringListVals  [SVariable CodeInfo]
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1
  stringListLists :: [SVariable CodeInfo] -> SValue CodeInfo -> MSStatement CodeInfo
stringListLists [SVariable CodeInfo]
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

instance FuncAppStatement CodeInfo where
  inOutCall :: InOutCall CodeInfo
inOutCall String
n [SValue CodeInfo]
vs [SVariable CodeInfo]
_ [SVariable CodeInfo]
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    String -> SValue CodeInfo
addCurrModCall String
n
  selfInOutCall :: InOutCall CodeInfo
selfInOutCall String
n [SValue CodeInfo]
vs [SVariable CodeInfo]
_ [SVariable CodeInfo]
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    String -> SValue CodeInfo
addCurrModCall String
n
  extInOutCall :: String -> InOutCall CodeInfo
extInOutCall String
l String
n [SValue CodeInfo]
vs [SVariable CodeInfo]
_ [SVariable CodeInfo]
_ = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ do
    forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [SValue CodeInfo]
vs
    String -> String -> SValue CodeInfo
addExternalCall String
l String
n

instance CommentStatement CodeInfo where
  comment :: String -> MSStatement CodeInfo
comment String
_ = forall s. State s (CodeInfo ())
noInfo

instance ControlStatement CodeInfo where
  break :: MSStatement CodeInfo
break    = forall s. State s (CodeInfo ())
noInfo
  continue :: MSStatement CodeInfo
continue = forall s. State s (CodeInfo ())
noInfo

  returnStmt :: SValue CodeInfo -> MSStatement CodeInfo
returnStmt = forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1

  throw :: String -> MSStatement CodeInfo
throw String
_ = forall s a. (s -> s) -> a -> State s a
modifyReturn (ExceptionType -> MethodState -> MethodState
addException ExceptionType
Standard) (forall (r :: * -> *) a. Monad r => a -> r a
toCode ())

  ifCond :: [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo -> MSStatement CodeInfo
ifCond = [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo -> MSStatement CodeInfo
evalConds
  switch :: SValue CodeInfo
-> [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo
-> MSStatement CodeInfo
switch SValue CodeInfo
v [(SValue CodeInfo, MSBody CodeInfo)]
cs MSBody CodeInfo
b = do
    CodeInfo ()
_ <- forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v
    [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo -> MSStatement CodeInfo
evalConds [(SValue CodeInfo, MSBody CodeInfo)]
cs MSBody CodeInfo
b

  ifExists :: SValue CodeInfo
-> MSBody CodeInfo -> MSBody CodeInfo -> MSStatement CodeInfo
ifExists SValue CodeInfo
v = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)

  for :: MSStatement CodeInfo
-> SValue CodeInfo
-> MSStatement CodeInfo
-> MSBody CodeInfo
-> MSStatement CodeInfo
for MSStatement CodeInfo
dec SValue CodeInfo
v = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute4 MSStatement CodeInfo
dec (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)
  forRange :: SVariable CodeInfo
-> SValue CodeInfo
-> SValue CodeInfo
-> SValue CodeInfo
-> MSBody CodeInfo
-> MSStatement CodeInfo
forRange SVariable CodeInfo
_ SValue CodeInfo
b SValue CodeInfo
e SValue CodeInfo
s = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute4 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
b) (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
e) 
    (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
s)
  forEach :: SVariable CodeInfo
-> SValue CodeInfo -> MSBody CodeInfo -> MSStatement CodeInfo
forEach SVariable CodeInfo
_ SValue CodeInfo
v = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)
  while :: SValue CodeInfo -> MSBody CodeInfo -> MSStatement CodeInfo
while SValue CodeInfo
v = forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS SValue CodeInfo
v)

  tryCatch :: MSBody CodeInfo -> MSBody CodeInfo -> MSStatement CodeInfo
tryCatch MSBody CodeInfo
_ MSBody CodeInfo
cb = do
    CodeInfo ()
_ <- MSBody CodeInfo
cb
    forall s. State s (CodeInfo ())
noInfo

instance StatePattern CodeInfo where
  checkState :: String
-> [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo
-> MSStatement CodeInfo
checkState String
_ = [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo -> MSStatement CodeInfo
evalConds

instance ObserverPattern CodeInfo where
  notifyObservers :: VSFunction CodeInfo -> VSType CodeInfo -> MSStatement CodeInfo
notifyObservers VSFunction CodeInfo
f VSType CodeInfo
_ = forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS VSFunction CodeInfo
f)
  
instance StrategyPattern CodeInfo where
  runStrategy :: String
-> [(String, MSBody CodeInfo)]
-> Maybe (SValue CodeInfo)
-> Maybe (SVariable CodeInfo)
-> MSBlock CodeInfo
runStrategy String
_ [(String, MSBody CodeInfo)]
ss Maybe (SValue CodeInfo)
vl Maybe (SVariable CodeInfo)
_ = do
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a b. (a, b) -> b
snd [(String, MSBody CodeInfo)]
ss
    CodeInfo ()
_ <- forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a -> a
fromMaybe forall s. State s (CodeInfo ())
noInfo Maybe (SValue CodeInfo)
vl
    forall s. State s (CodeInfo ())
noInfo

instance ScopeSym CodeInfo where
  type Scope CodeInfo = ScopeTag
  private :: CodeInfo (Scope CodeInfo)
private = forall (r :: * -> *) a. Monad r => a -> r a
toCode ScopeTag
Priv
  public :: CodeInfo (Scope CodeInfo)
public  = forall (r :: * -> *) a. Monad r => a -> r a
toCode ScopeTag
Pub

instance ParameterSym CodeInfo where
  type Parameter CodeInfo = ()
  param :: SVariable CodeInfo -> MSParameter CodeInfo
param        SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  pointerParam :: SVariable CodeInfo -> MSParameter CodeInfo
pointerParam SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo

instance MethodSym CodeInfo where
  type Method CodeInfo = ()
  method :: String
-> CodeInfo (Scope CodeInfo)
-> CodeInfo (Permanence CodeInfo)
-> VSType CodeInfo
-> [MSParameter CodeInfo]
-> MSBody CodeInfo
-> SMethod CodeInfo
method String
n CodeInfo (Scope CodeInfo)
_ CodeInfo (Permanence CodeInfo)
_ VSType CodeInfo
_ [MSParameter CodeInfo]
_ = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n
  getMethod :: SVariable CodeInfo -> SMethod CodeInfo
getMethod SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  setMethod :: SVariable CodeInfo -> SMethod CodeInfo
setMethod SVariable CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  constructor :: [MSParameter CodeInfo]
-> NamedArgs CodeInfo -> MSBody CodeInfo -> SMethod CodeInfo
constructor [MSParameter CodeInfo]
_ NamedArgs CodeInfo
il MSBody CodeInfo
b = do
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd) NamedArgs CodeInfo
il
    CodeInfo ()
_ <- MSBody CodeInfo
b
    String
cn <- MS String
getClassName
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (String -> MethodState -> MethodState
updateCallMap String
cn forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> MethodState -> MethodState
updateMethodExcMap String
cn)
    forall s. State s (CodeInfo ())
noInfo

  docMain :: MSBody CodeInfo -> SMethod CodeInfo
docMain = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
"main"

  function :: String
-> CodeInfo (Scope CodeInfo)
-> VSType CodeInfo
-> [MSParameter CodeInfo]
-> MSBody CodeInfo
-> SMethod CodeInfo
function String
n CodeInfo (Scope CodeInfo)
_ VSType CodeInfo
_ [MSParameter CodeInfo]
_ = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n
  mainFunction :: MSBody CodeInfo -> SMethod CodeInfo
mainFunction = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
"main"

  docFunc :: String
-> [String] -> Maybe String -> SMethod CodeInfo -> SMethod CodeInfo
docFunc String
_ [String]
_ Maybe String
_ SMethod CodeInfo
f = do
    CodeInfo ()
_ <- SMethod CodeInfo
f
    forall s. State s (CodeInfo ())
noInfo

  inOutMethod :: String
-> CodeInfo (Scope CodeInfo)
-> CodeInfo (Permanence CodeInfo)
-> InOutFunc CodeInfo
inOutMethod    String
n CodeInfo (Scope CodeInfo)
_ CodeInfo (Permanence CodeInfo)
_ [SVariable CodeInfo]
_ [SVariable CodeInfo]
_ [SVariable CodeInfo]
_   = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n

  docInOutMethod :: String
-> CodeInfo (Scope CodeInfo)
-> CodeInfo (Permanence CodeInfo)
-> DocInOutFunc CodeInfo
docInOutMethod String
n CodeInfo (Scope CodeInfo)
_ CodeInfo (Permanence CodeInfo)
_ String
_ [(String, SVariable CodeInfo)]
_ [(String, SVariable CodeInfo)]
_ [(String, SVariable CodeInfo)]
_ = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n

  inOutFunc :: String -> CodeInfo (Scope CodeInfo) -> InOutFunc CodeInfo
inOutFunc      String
n CodeInfo (Scope CodeInfo)
_ [SVariable CodeInfo]
_ [SVariable CodeInfo]
_ [SVariable CodeInfo]
_     = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n

  docInOutFunc :: String -> CodeInfo (Scope CodeInfo) -> DocInOutFunc CodeInfo
docInOutFunc   String
n CodeInfo (Scope CodeInfo)
_ String
_ [(String, SVariable CodeInfo)]
_ [(String, SVariable CodeInfo)]
_ [(String, SVariable CodeInfo)]
_   = String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n

instance StateVarSym CodeInfo where
  type StateVar CodeInfo = ()
  stateVar :: CodeInfo (Scope CodeInfo)
-> CodeInfo (Permanence CodeInfo)
-> SVariable CodeInfo
-> CSStateVar CodeInfo
stateVar    CodeInfo (Scope CodeInfo)
_ CodeInfo (Permanence CodeInfo)
_ SVariable CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo
  stateVarDef :: CodeInfo (Scope CodeInfo)
-> CodeInfo (Permanence CodeInfo)
-> SVariable CodeInfo
-> SValue CodeInfo
-> CSStateVar CodeInfo
stateVarDef CodeInfo (Scope CodeInfo)
_ CodeInfo (Permanence CodeInfo)
_ SVariable CodeInfo
_ SValue CodeInfo
_ = forall s. State s (CodeInfo ())
noInfo
  constVar :: CodeInfo (Scope CodeInfo)
-> SVariable CodeInfo -> SValue CodeInfo -> CSStateVar CodeInfo
constVar    CodeInfo (Scope CodeInfo)
_ SVariable CodeInfo
_ SValue CodeInfo
_   = forall s. State s (CodeInfo ())
noInfo

instance ClassSym CodeInfo where
  type Class CodeInfo = ()
  buildClass :: Maybe String
-> [CSStateVar CodeInfo] -> [SMethod CodeInfo] -> SClass CodeInfo
buildClass Maybe String
_ [CSStateVar CodeInfo]
_ [SMethod CodeInfo]
ms = do
    String
n <- forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' ClassState FileState
lensCStoFS FS String
getModuleName
    forall (r :: * -> *).
ClassSym r =>
String -> [String] -> [CSStateVar r] -> [SMethod r] -> SClass r
implementingClass String
n [] [] [SMethod CodeInfo]
ms
  extraClass :: String
-> Maybe String
-> [CSStateVar CodeInfo]
-> [SMethod CodeInfo]
-> SClass CodeInfo
extraClass String
n Maybe String
_ [CSStateVar CodeInfo]
_ [SMethod CodeInfo]
ms = do
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (String -> ClassState -> ClassState
setClassName String
n)
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' ClassState MethodState
lensCStoMS) [SMethod CodeInfo]
ms
    forall s. State s (CodeInfo ())
noInfo
  implementingClass :: String
-> [String]
-> [CSStateVar CodeInfo]
-> [SMethod CodeInfo]
-> SClass CodeInfo
implementingClass String
n [String]
_ [CSStateVar CodeInfo]
_ [SMethod CodeInfo]
ms = do
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (String -> ClassState -> ClassState
addClass String
n forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ClassState -> ClassState
setClassName String
n)
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' ClassState MethodState
lensCStoMS) [SMethod CodeInfo]
ms
    forall s. State s (CodeInfo ())
noInfo

  docClass :: String -> SClass CodeInfo -> SClass CodeInfo
docClass String
_ SClass CodeInfo
c = do
    CodeInfo ()
_ <- SClass CodeInfo
c
    forall s. State s (CodeInfo ())
noInfo

instance ModuleSym CodeInfo where
  type Module CodeInfo = ()
  buildModule :: String
-> [String]
-> [SMethod CodeInfo]
-> [SClass CodeInfo]
-> FSModule CodeInfo
buildModule String
n [String]
_ [SMethod CodeInfo]
fs [SClass CodeInfo]
cs = do
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (String -> FileState -> FileState
setModuleName String
n)
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' FileState ClassState
lensFStoCS) [SClass CodeInfo]
cs 
    forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' FileState MethodState
lensFStoMS) [SMethod CodeInfo]
fs
    forall s a. (s -> s) -> a -> State s a
modifyReturn (String -> FileState -> FileState
updateClassMap String
n) (forall (r :: * -> *) a. Monad r => a -> r a
toCode ())

-- Helpers

noInfo :: State s (CodeInfo ())
noInfo :: forall s. State s (CodeInfo ())
noInfo = forall a s. a -> State s a
toState forall a b. (a -> b) -> a -> b
$ forall (r :: * -> *) a. Monad r => a -> r a
toCode ()

noInfoType :: State s (CodeInfo String)
noInfoType :: forall s. State s (CodeInfo String)
noInfoType = forall a s. a -> State s a
toState forall a b. (a -> b) -> a -> b
$ forall (r :: * -> *) a. Monad r => a -> r a
toCode String
""

updateMEMandCM :: String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM :: String -> MSBody CodeInfo -> SMethod CodeInfo
updateMEMandCM String
n MSBody CodeInfo
b = do
  CodeInfo ()
_ <- MSBody CodeInfo
b
  forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (String -> MethodState -> MethodState
updateCallMap String
n forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> MethodState -> MethodState
updateMethodExcMap String
n)
  forall s. State s (CodeInfo ())
noInfo

evalConds :: [(SValue CodeInfo, MSBody CodeInfo)] -> MSBody CodeInfo -> 
  MSStatement CodeInfo
evalConds :: [(SValue CodeInfo, MSBody CodeInfo)]
-> MSBody CodeInfo -> MSStatement CodeInfo
evalConds [(SValue CodeInfo, MSBody CodeInfo)]
cs MSBody CodeInfo
def = do
  forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' MethodState ValueState
lensMStoVS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst) [(SValue CodeInfo, MSBody CodeInfo)]
cs
  forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a b. (a, b) -> b
snd [(SValue CodeInfo, MSBody CodeInfo)]
cs
  CodeInfo ()
_ <- MSBody CodeInfo
def
  forall s. State s (CodeInfo ())
noInfo

addCurrModCall :: String -> SValue CodeInfo
addCurrModCall :: String -> SValue CodeInfo
addCurrModCall String
n = do
  String
mn <- forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom Lens' ValueState FileState
lensVStoFS FS String
getModuleName 
  forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (QualifiedName -> ValueState -> ValueState
addCall (String -> String -> QualifiedName
qualName String
mn String
n)) 
  forall s. State s (CodeInfo ())
noInfo

addCurrModConstructorCall :: VSType CodeInfo -> SValue CodeInfo
addCurrModConstructorCall :: VSType CodeInfo -> SValue CodeInfo
addCurrModConstructorCall VSType CodeInfo
ot = do
  CodeInfo String
t <- VSType CodeInfo
ot
  let tp :: String
tp = forall (r :: * -> *). TypeElim r => r (Type r) -> String
getTypeString CodeInfo String
t
  String -> SValue CodeInfo
addCurrModCall String
tp

addExternalCall :: String -> String -> SValue CodeInfo
addExternalCall :: String -> String -> SValue CodeInfo
addExternalCall String
l String
n = forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (QualifiedName -> ValueState -> ValueState
addCall (String -> String -> QualifiedName
qualName String
l String
n)) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall s. State s (CodeInfo ())
noInfo

addExternalConstructorCall :: String -> VSType CodeInfo -> SValue CodeInfo
addExternalConstructorCall :: String -> VSType CodeInfo -> SValue CodeInfo
addExternalConstructorCall String
l VSType CodeInfo
ot = do
  CodeInfo String
t <- VSType CodeInfo
ot
  let tp :: String
tp = forall (r :: * -> *). TypeElim r => r (Type r) -> String
getTypeString CodeInfo String
t
  String -> String -> SValue CodeInfo
addExternalCall String
l String
tp

execute1 :: State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 :: forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 State a (CodeInfo ())
s = do
  CodeInfo ()
_ <- State a (CodeInfo ())
s
  forall s. State s (CodeInfo ())
noInfo

executeList :: [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList :: forall a. [State a (CodeInfo ())] -> State a (CodeInfo ())
executeList [State a (CodeInfo ())]
l = do
  forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [State a (CodeInfo ())]
l
  forall s. State s (CodeInfo ())
noInfo

executePairList :: [(State a (CodeInfo ()), State a (CodeInfo ()))] -> 
  State a (CodeInfo ())
executePairList :: forall a.
[(State a (CodeInfo ()), State a (CodeInfo ()))]
-> State a (CodeInfo ())
executePairList [(State a (CodeInfo ()), State a (CodeInfo ()))]
ps = do
  forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a b. (a, b) -> a
fst [(State a (CodeInfo ()), State a (CodeInfo ()))]
ps
  forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a b. (a, b) -> b
snd [(State a (CodeInfo ()), State a (CodeInfo ()))]
ps
  forall s. State s (CodeInfo ())
noInfo

execute2 :: State a (CodeInfo ()) -> State a (CodeInfo ()) -> 
  State a (CodeInfo ())
execute2 :: forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 State a (CodeInfo ())
s1 State a (CodeInfo ())
s2 = do
  CodeInfo ()
_ <- State a (CodeInfo ())
s1
  forall a. State a (CodeInfo ()) -> State a (CodeInfo ())
execute1 State a (CodeInfo ())
s2

execute3 :: State a (CodeInfo ()) -> State a (CodeInfo ()) -> 
  State a (CodeInfo ()) -> State a (CodeInfo ())
execute3 :: forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3 State a (CodeInfo ())
s1 State a (CodeInfo ())
s2 State a (CodeInfo ())
s3 = do
  CodeInfo ()
_ <- State a (CodeInfo ())
s1
  forall a.
State a (CodeInfo ())
-> State a (CodeInfo ()) -> State a (CodeInfo ())
execute2 State a (CodeInfo ())
s2 State a (CodeInfo ())
s3

execute4 :: State a (CodeInfo ()) -> State a (CodeInfo ()) -> 
  State a (CodeInfo ()) -> State a (CodeInfo ()) -> State a (CodeInfo ())
execute4 :: forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute4 State a (CodeInfo ())
s1 State a (CodeInfo ())
s2 State a (CodeInfo ())
s3 State a (CodeInfo ())
s4 = do
  CodeInfo ()
_ <- State a (CodeInfo ())
s1
  forall a.
State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
-> State a (CodeInfo ())
execute3 State a (CodeInfo ())
s2 State a (CodeInfo ())
s3 State a (CodeInfo ())
s4

currModCall :: String -> [VS (CodeInfo ())] -> 
  [(VS (CodeInfo ()), VS (CodeInfo ()))] -> VS (CodeInfo ())
currModCall :: String
-> [VS (CodeInfo ())]
-> [(VS (CodeInfo ()), VS (CodeInfo ()))]
-> VS (CodeInfo ())
currModCall String
n [VS (CodeInfo ())]
ps [(VS (CodeInfo ()), VS (CodeInfo ()))]
ns = do
  forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [VS (CodeInfo ())]
ps
  forall a.
[(State a (CodeInfo ()), State a (CodeInfo ()))]
-> State a (CodeInfo ())
executePairList [(VS (CodeInfo ()), VS (CodeInfo ()))]
ns
  String -> SValue CodeInfo
addCurrModCall String
n