def make_mkEffectFn(n: int): myname = 'mkEffectFn{}'.format(n) args = ["x{}".format(i) for i in range(n)] fn = 'fn' fcall = var(fn) for each in args: fcall = call(fcall, var(each)) fcall = call(fcall) meta_code = make_mkEffectFn.__code__ ast = metadata( meta_code.co_firstlineno, 1, meta_code.co_filename, define(myname, [fn], define(None, args, fcall)), ) code = module_code(ast, name=__name__, filename=__file__) G[myname] = eval(code) __all__.append(myname)
def make_runEffectFn(n: int): myname = 'runEffectFn{}'.format(n) args = ["x{}".format(i) for i in range(n)] fn = 'fn' fcall = call(var(fn), *map(var, args)) lam = define(None, [], fcall) for arg in reversed(args): lam = define(None, [var(arg)], lam) meta_code = make_runEffectFn.__code__ ast = metadata( meta_code.co_firstlineno, 1, meta_code.co_filename, lam, ) code = module_code(ast, name=__name__, filename=__file__) G[myname] = eval(code) __all__.append(myname)
get_item( var( "ps_SmallPrelude" ), "println" ), call( var( "ps_testDeconsGuard" ), get_attr( var( "ps_Zero" ), "value" ) ))) ))))))))))))))) ), assign( "exports", record(("Zero", var("ps_Zero")), ("Succ", var("ps_Succ")), ("natToInt", var("ps_natToInt")), ("natToIntRecImpl", var("ps_natToIntRecImpl")), ("natToIntRec", var("ps_natToIntRec")), ("intToNatRecImpl", var("ps_intToNatRecImpl")), ("intToNatRec", var("ps_intToNatRec")), ("_3", var("ps__3")), ("testDeconsGuard", var("ps_testDeconsGuard")), ("main", var("ps_main"))))) res = module_code(res, filename=__file__, name="pattern_matching.Main")
None, ["ps_a"], block( ret( call( get_item(var("$foreign"), "error"), call( call( get_item(var("ps_Data_Show"), "show"), var("ps_dictShow")), var("ps_a")))))))))), assign( "exports", record(("logShow", var("ps_logShow")), ("warnShow", var("ps_warnShow")), ("errorShow", var("ps_errorShow")), ("infoShow", var("ps_infoShow")), ("log", get_item(var("$foreign"), "log")), ("warn", get_item(var("$foreign"), "warn")), ("error", get_item(var("$foreign"), "error")), ("info", get_item(var("$foreign"), "info")), ("time", get_item(var("$foreign"), "time")), ("timeLog", get_item(var("$foreign"), "timeLog")), ("timeEnd", get_item(var("$foreign"), "timeEnd")), ("clear", get_item(var("$foreign"), "clear"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\console\\v4.4.0\\src\\Effect\\Console.purs", name="hw.Effect.Console.pure")
ret( define( None, ["ps_m"], block( ret( call( call( call(var("ps_bind"), var("ps_dictBind")), var("ps_m")), call( get_item(var("ps_Control_Category"), "identity"), get_item(var("ps_Control_Category"), "categoryFn")))))))))), assign( "exports", record(("Bind", var("ps_Bind")), ("bind", var("ps_bind")), ("bindFlipped", var("ps_bindFlipped")), ("Discard", var("ps_Discard")), ("discard", var("ps_discard")), ("join", var("ps_join")), ("composeKleisli", var("ps_composeKleisli")), ("composeKleisliFlipped", var("ps_composeKleisliFlipped")), ("ifM", var("ps_ifM")), ("bindFn", var("ps_bindFn")), ("bindArray", var("ps_bindArray")), ("discardUnit", var("ps_discardUnit"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Control\\Bind.purs", name="hw.Control.Bind.pure")
17, 14, "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Data\\Ordering.purs", True))), None), ite( ite(isa(var("ps_v"), var("ps_EQ")), isa(var("ps_v1"), var("ps_EQ")), False), block( ret( metadata( 18, 14, "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Data\\Ordering.purs", True))), None), ret( metadata( 19, 14, "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Data\\Ordering.purs", False))))))))), assign( "exports", record(("LT", var("ps_LT")), ("GT", var("ps_GT")), ("EQ", var("ps_EQ")), ("invert", var("ps_invert")), ("eqOrdering", var("ps_eqOrdering")), ("semigroupOrdering", var("ps_semigroupOrdering")), ("showOrdering", var("ps_showOrdering"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Data\\Ordering.purs", name="hw.Data.Ordering.pure")
from purescripto.rts import META_ENV from purescripto.topdown import load_topdown from py_sexpr.stack_vm.emit import module_code import zipfile import io filename = "C:/Users/twshe/Desktop/mydb/com-haskell/v0.1/purescript-cyberbrain/purescript_cyberbrain/Data/Show/pure.zip.py" # filename = 'C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-cyberbrain\\purescript_cyberbrain\\Cyberbrain\\PyInstructions\\pure.zip.py' zip = zipfile.ZipFile(filename) file = io.StringIO(zip.read("source").decode("utf8")) sexpr = load_topdown(file, META_ENV) module_code(sexpr)
from py_sexpr.terms import * from py_sexpr.stack_vm.emit import module_code res = block( "No document", assign_star( "$foreign", call(var('import_module'), "purescript_show_python.ffi.Python.IO.Unsafe")), assign_star("ps_assert", get_item(var("$foreign"), "assert_")), assign( "exports", record(("assert", var("ps_assert")), ("show", get_item(var("$foreign"), "show")), ("printLn", get_item(var("$foreign"), "printLn")), ("repr", get_item(var("$foreign"), "repr")), ("assertMsg", get_item(var("$foreign"), "assertMsg"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\src\\Python\\IO\\Unsafe.purs", name="purescript_show_python.Python.IO.Unsafe.pure")
, "info" ) , call( call( get_item( var( "ps_Data_Show" ) , "show" ) , var( "ps_dictShow" ) ) , var( "ps_a" ) ) ) ) ) ) ) ) ) ) , assign_star( "ps_errorShow" , define( None , ["ps_dictShow"] , block( ret( define( None , ["ps_a"] , block( ret( call( get_item( var( "$foreign" ) , "error" ) , call( call( get_item( var( "ps_Data_Show" ) , "show" ) , var( "ps_dictShow" ) ) , var( "ps_a" ) ) ) ) ) ) ) ) ) ) , assign( "exports" , record( ("logShow", var("ps_logShow")) , ("warnShow", var("ps_warnShow")) , ("errorShow", var("ps_errorShow")) , ("infoShow", var("ps_infoShow")) , ("log", get_item(var("$foreign"), "log")) , ("warn", get_item(var("$foreign"), "warn")) , ("error", get_item(var("$foreign"), "error")) , ("info", get_item(var("$foreign"), "info")) , ("time", get_item(var("$foreign"), "time")) , ("timeLog", get_item(var("$foreign"), "timeLog")) , ("timeEnd", get_item(var("$foreign"), "timeEnd")) , ("clear", get_item(var("$foreign"), "clear")) ) ) ) res = module_code(res, filename="C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\.spago\\console\\v4.4.0\\src\\Effect\\Console.purs", name="purescript_show_python.Effect.Console.pure")
from py_sexpr.terms import * from py_sexpr.stack_vm.emit import module_code res = block( "No document", assign_star( "ps_RLProxy", block(define("ps_RLProxy", [".this"], block(var(".this"))), set_attr(var("ps_RLProxy"), "value", new(var("ps_RLProxy"))), var("ps_RLProxy"))), assign("exports", record(("RLProxy", var("ps_RLProxy"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Type\\Data\\RowList.purs", name="hw.Type.Data.RowList.pure")
call( call(get_item(get_attr(var("$foreign"), "linq"), "map"), get_attr(var("$foreign"), "f")), var("ps_opt1"))), assign( "ps_list1", call( get_attr(var("$foreign"), "mkPyList"), metadata( 16, 19, joinpath(project_path, "src\\Example.purs"), mktuple( metadata(16, 20, joinpath(project_path, "src\\Example.purs"), 1), metadata(16, 23, joinpath(project_path, "src\\Example.purs"), 2))))), assign( "ps_test1", call( call(get_item(get_attr(var("$foreign"), "linq"), "map"), get_attr(var("$foreign"), "f")), var("ps_list1"))), assign( "exports", record(("list1", var("ps_list1")), ("opt1", var("ps_opt1")), ("opt2", var("ps_opt2")), ("test1", var("ps_test1")), ("test2", var("ps_test2")), ("test3", var("ps_test3")), ("mkPyList", get_attr(var("$foreign"), "mkPyList")), ("mkPyOption", get_attr(var("$foreign"), "mkPyOption")), ("mkPyNone", get_attr(var("$foreign"), "mkPyNone")), ("f", get_attr(var("$foreign"), "f")), ("linq", get_attr(var("$foreign"), "linq"))))) res = module_code(res)
from py_sexpr.terms import * from py_sexpr.stack_vm.emit import module_code res = block( "No document", assign_star("ps_Effect_Console", call(var('import_module'), "hw.Effect.Console.pure")), assign_star( "ps_main", call( get_item(var("ps_Effect_Console"), "log"), metadata( 10, 7, "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\src\\Main.purs", "🍝"))), assign("exports", record(("main", var("ps_main"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\src\\Main.purs", name="hw.Main.pure")
define(None, ["ps_x"], block(ret(define(None, ["ps_v"], block(ret(var("ps_x"))))))))), assign_star( "ps_applicativeArray", new( var("ps_Applicative"), define(None, ["ps_$__unused"], block(ret(get_item(var("ps_Control_Apply"), "applyArray")))), define( None, ["ps_x"], block( ret( metadata( 40, 12, "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\.spago\\prelude\\v4.1.1\\src\\Control\\Applicative.purs", mktuple(var("ps_x")))))))), assign( "exports", record(("Applicative", var("ps_Applicative")), ("pure", var("ps_pure")), ("liftA1", var("ps_liftA1")), ("unless", var("ps_unless")), ("when", var("ps_when")), ("applicativeFn", var("ps_applicativeFn")), ("applicativeArray", var("ps_applicativeArray"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\.spago\\prelude\\v4.1.1\\src\\Control\\Applicative.purs", name="purescript_show_python.Control.Applicative.pure")
from py_sexpr.terms import * from py_sexpr.stack_vm.emit import module_code res = block( " | The functions in this module are highly unsafe as they treat records like | stringly-keyed maps and can coerce the row of labels that a record has. | | These function are intended for situations where there is some other way of | proving things about the structure of the record - for example, when using | `RowToList`. **They should never be used for general record manipulation.**", assign_star("$foreign", call(var('import_module'), "hw.ffi.Record.Unsafe")), assign( "exports", record(("unsafeHas", get_item(var("$foreign"), "unsafeHas")), ("unsafeGet", get_item(var("$foreign"), "unsafeGet")), ("unsafeSet", get_item(var("$foreign"), "unsafeSet")), ("unsafeDelete", get_item(var("$foreign"), "unsafeDelete"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Record\\Unsafe.purs", name="hw.Record.Unsafe.pure")
, [ ] , block( assign_star( "ps_x2" , call( call( get_item( var( "ps_Python_IO_Unsafe" ) , "repr" ) , metadata( 31 , 25 , "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\test\\Main.purs" , 1 ) ) ) ) , assign_star( "ps_y2" , call( call( get_item( var( "ps_Python_IO_Unsafe" ) , "repr" ) , metadata( 32 , 20 , "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\test\\Main.purs" , 1 ) ) ) ) , ret( call( call( get_item( var( "ps_Python_IO_Unsafe" ) , "assert" ) , cmp( var( "ps_x2" ) , Compare.EQ , var( "ps_y2" ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) , assign( "exports" , record( ("A1", var("ps_A1")) , ("N", var("ps_N")) , ("Box", var("ps_Box")) , ("main", var("ps_main")) ) ) ) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\test\\Main.purs", name="purescript_show_python.Test.Main.pure")
block( ret( call( call( call(var("ps_sub"), var("ps_dictRing")), call( get_item(var("ps_Data_Semiring"), "zero"), call( get_item( var("ps_dictRing"), "Semiring0")))), var("ps_a"))))))))), assign( "exports", record( ("Ring", var("ps_Ring")), ("sub", var("ps_sub")), ("negate", var("ps_negate")), ("RingRecord", var("ps_RingRecord")), ("subRecord", var("ps_subRecord")), ("ringInt", var("ps_ringInt")), ("ringNumber", var("ps_ringNumber")), ("ringUnit", var("ps_ringUnit")), ("ringFn", var("ps_ringFn")), ("ringRecord", var("ps_ringRecord")), ("ringRecordNil", var("ps_ringRecordNil")), ("ringRecordCons", var("ps_ringRecordCons"))))) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\purescript-show-python\\.spago\\prelude\\v4.1.1\\src\\Data\\Ring.purs", name="purescript_show_python.Data.Ring.pure")
from py_sexpr.terms import * from py_sexpr.stack_vm.emit import module_code res = block("No document", assign("exports", record())) res = module_code( res, filename= "C:\\Users\\twshe\\Desktop\\mydb\\com-haskell\\v0.1\\hw\\.spago\\prelude\\v4.1.1\\src\\Data\\NaturalTransformation.purs", name="hw.Data.NaturalTransformation.pure")