Module("strategy/pack/common",[Imports([Import("term/string"),Import("strategy/pack/graph")]),Rules([RDefNoArgs("PackInit",RuleNoCond(Var("root"),NoAnnoList(Tuple([Var("root"),NoAnnoList(Tuple([])),NoAnnoList(List([]))]))))]),Strategies([SDef("pack",[DefaultVarDec("parser"),DefaultVarDec("imp")],Seq(CallNoArgs(SVar("PackInit")),Call(SVar("graph-nodes"),[Seq(CallNoArgs(SVar("Fst")),CallNoArgs(SVar("parser"))),Call(SVar("get-imports"),[CallNoArgs(SVar("imp"))]),LRule(RuleNoCond(NoAnnoList(Tuple([Var("n"),Var("x"),Var("xs")])),NoAnnoList(ListTail([Var("x")],Var("xs")))))]))),SDef("get-imports",[DefaultVarDec("imp")],Seq(Call(SVar("collect"),[CallNoArgs(SVar("imp"))]),CallNoArgs(SVar("concat"))))]),Rules([RDef("WriteMod",[DefaultVarDec("getname"),DefaultVarDec("write"),DefaultVarDec("ext")],RuleNoCond(Var("mod"),App(CallNoArgs(SVar("write")),NoAnnoList(Tuple([App(CallNoArgs(SVar("add-extension")),NoAnnoList(Tuple([App(CallNoArgs(SVar("getname")),Var("mod")),App(CallNoArgs(SVar("ext")),NoAnnoList(Tuple([])))]))),Var("mod")])))))]),Strategies([SDef("unpack",[VarDec("wrapper",FunType([FunType([ConstType(SortVar("term"))],ConstType(SortVar("term"))),ConstType(SortVar("term"))],ConstType(SortVar("term")))),DefaultVarDec("getname"),DefaultVarDec("ext")],Call(SVar("wrapper"),[Call(SVar("WriteMod"),[CallNoArgs(SVar("getname")),CallNoArgs(SVar("WriteToTextFile")),CallNoArgs(SVar("ext"))])]))]),Strategies([SDef("flatten",[DefaultVarDec("imp"),DefaultVarDec("nameeq"),DefaultVarDec("getcontent")],Seq(LRule(RuleNoCond(NoAnnoList(Tuple([Var("root"),Var("mods")])),NoAnnoList(Tuple([Var("root"),Var("mods"),NoAnnoList(List([]))])))),Call(SVar("graph-nodes"),[Call(SVar("lookup"),[CallNoArgs(SVar("nameeq"))]),Call(SVar("get-imports"),[CallNoArgs(SVar("imp"))]),LRule(RuleNoCond(NoAnnoList(Tuple([Wld,Var("x"),Var("y")])),App(CallNoArgs(SVar("conc")),NoAnnoList(Tuple([App(CallNoArgs(SVar("getcontent")),Var("x")),Var("y")])))))])))])])
