Module "EventOracle" Nothing [(ImportDecl (1,1) "Prelude" False Nothing Nothing) ,(ImportDecl (3,1) "IOExts" False Nothing Nothing) ,(ImportDecl (4,1) "Unsafe" False Nothing Nothing) ,(ImportDecl (5,1) "System" False Nothing (Just (Importing (5,15) [(Import (Ident "getProgName" 0))]))) ,(TypeDecl (8,1) (Ident "Ref" 0) [] (ConstructorType (QualIdent Nothing (Ident "IORef" 0)) [(ConstructorType (QualIdent Nothing (Ident "Node" 0)) [])])) ,(DataDecl (9,1) (Ident "Node" 0) [] [(ConstrDecl (9,13) [] (Ident "Node" 0) [(ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []),(ConstructorType (QualIdent Nothing (Ident "Cost" 0)) []),(ConstructorType (QualIdent Nothing (Ident "Ref" 0)) [])]),(ConstrDecl (9,33) [] (Ident "Marker" 0) []),(ConstrDecl (9,42) [] (Ident "Collapsed" 0) [])]) ,(TypeDecl (10,1) (Ident "Cost" 0) [] (ConstructorType (QualIdent Nothing (Ident "Int" 0)) [])) ,(TypeSig (12,1) [(Ident "initialize" 0)] (ArrowType (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(VariableType (Ident "a" 0))])) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(TupleType [])]))) ,(FunctionDecl (13,1) (Ident "initialize" 0) [(Equation (13,1) (FunLhs (Ident "initialize" 0) [(VariablePattern (Ident "app" 2))]) (SimpleRhs (13,18) (Do [(StmtBind (VariablePattern (Ident "mod" 4)) (Variable (QualIdent (Just "System") (Ident "getProgName" 0)))),(StmtDecl [(PatternDecl (15,9) (VariablePattern (Ident "extFile" 5)) (SimpleRhs (15,19) (InfixApply (Variable (QualIdent Nothing (Ident "mod" 4))) (InfixOp (QualIdent (Just "Prelude") (Ident "++" 0))) (Literal (String ".ext"))) []))]),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "setAssoc" 0))) (Literal (String "extfn"))) (Variable (QualIdent Nothing (Ident "extFile" 5))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "Prelude") (Ident "writeFile" 0))) (Variable (QualIdent Nothing (Ident "extFile" 5)))) (Literal (String "")))),(StmtBind (VariablePattern (Ident "startMarker" 7)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "newIORef" 0))) (Paren (Apply (Variable (QualIdent (Just "Prelude") (Ident "error" 0))) (Literal (String "startMarker")))))),(StmtBind (VariablePattern (Ident "endMarker" 8)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "newIORef" 0))) (Paren (Apply (Variable (QualIdent (Just "Prelude") (Ident "error" 0))) (Literal (String "endMarker")))))),(StmtBind (VariablePattern (Ident "mainR" 10)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "newIORef" 0))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "startMarker" 7)))) (Literal (Int (Ident "_" 9) 0))) (Variable (QualIdent Nothing (Ident "endMarker" 8))))))),(StmtBind (VariablePattern (Ident "marker" 11)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "newIORef" 0))) (Constructor (QualIdent (Just "EventOracle") (Ident "Marker" 0))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "startMarker" 7)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "marker" 11)))) (Literal (Int (Ident "_" 12) 0))) (Variable (QualIdent Nothing (Ident "mainR" 10))))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "endMarker" 8)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "mainR" 10)))) (Literal (Int (Ident "_" 13) 0))) (Variable (QualIdent Nothing (Ident "marker" 11))))))),(StmtBind (VariablePattern (Ident "x" 14)) (Apply (Variable (QualIdent Nothing (Ident "app" 2))) (Variable (QualIdent Nothing (Ident "mainR" 10))))),(StmtExpr (InfixApply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (InfixOp (QualIdent (Just "Prelude") (Ident "$!!" 0))) (Variable (QualIdent Nothing (Ident "x" 14))))),(StmtExpr (Apply (Variable (QualIdent (Just "Prelude") (Ident "putStrLn" 0))) (Literal (String "finalizing")))),(StmtExpr (Apply (Apply (Apply (Variable (QualIdent (Just "EventOracle") (Ident "finalize" 0))) (Variable (QualIdent Nothing (Ident "mod" 4)))) (Variable (QualIdent Nothing (Ident "startMarker" 7)))) (Variable (QualIdent Nothing (Ident "endMarker" 8)))))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Tuple []))) []))]) ,(TypeSig (31,1) [(Ident "finalize" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "String" 0)) []) (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(TupleType [])]))))) ,(FunctionDecl (32,1) (Ident "finalize" 0) [(Equation (32,1) (FunLhs (Ident "finalize" 0) [(VariablePattern (Ident "mod" 15)),(VariablePattern (Ident "fmR" 15)),(VariablePattern (Ident "endR" 15))]) (SimpleRhs (32,25) (Do [(StmtBind (InfixPattern (VariablePattern (Ident "_" 18)) (QualIdent Nothing (Ident ":" 0)) (VariablePattern (Ident "l" 17))) (Apply (Apply (Variable (QualIdent (Just "EventOracle") (Ident "pointerToList" 0))) (Variable (QualIdent Nothing (Ident "fmR" 15)))) (Variable (QualIdent Nothing (Ident "endR" 15)))))] (Apply (Apply (Variable (QualIdent (Just "Prelude") (Ident "writeFile" 0))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "mod" 15))) (InfixOp (QualIdent (Just "Prelude") (Ident "++" 0))) (Literal (String ".steps"))))) (Paren (InfixApply (Apply (Variable (QualIdent (Just "Prelude") (Ident "show" 0))) (Variable (QualIdent Nothing (Ident "l" 17)))) (InfixOp (QualIdent (Just "Prelude") (Ident "++" 0))) (Literal (String "\n.\n")))))) []))]) ,(TypeSig (37,1) [(Ident "fresh" 0)] (ArrowType (TupleType []) (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []))) ,(FunctionDecl (38,1) (Ident "fresh" 0) [(Equation (38,1) (FunLhs (Ident "fresh" 0) [(VariablePattern (Ident "_" 20))]) (SimpleRhs (38,11) (Apply (Variable (QualIdent (Just "Unsafe") (Ident "unsafePerformIO" 0))) (Paren (Apply (Variable (QualIdent (Just "IOExts") (Ident "newIORef" 0))) (Paren (Apply (Variable (QualIdent (Just "Prelude") (Ident "error" 0))) (Literal (String "fresh"))))))) []))]) ,(TypeSig (41,1) [(Ident "replace" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (VariableType (Ident "a" 0)) (VariableType (Ident "a" 0))))) ,(FunctionDecl (42,1) (Ident "replace" 0) [(Equation (42,1) (FunLhs (Ident "replace" 0) [(VariablePattern (Ident "ref" 22)),(VariablePattern (Ident "x" 22))]) (SimpleRhs (42,17) (Apply (Variable (QualIdent (Just "Unsafe") (Ident "unsafePerformIO" 0))) (Paren (Do [(StmtBind (VariablePattern (Ident "node" 24)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 22))))),(StmtExpr (Case (Variable (QualIdent Nothing (Ident "node" 24))) [(Alt (46,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (46,20) (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "tried to replace collapsed ref"))) [])),(Alt (47,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "p" 27)),(VariablePattern (Ident "c" 27)),(VariablePattern (Ident "s" 27))]) (SimpleRhs (47,21) (InfixApply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 22)))) (InfixOp (QualIdent (Just "Prelude") (Ident "$!!" 0))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "p" 27)))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "c" 27))) (InfixOp (QualIdent (Just "Prelude") (Ident "+" 0))) (Literal (Int (Ident "_" 29) 1))))) (Variable (QualIdent Nothing (Ident "s" 27)))))) []))]))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Variable (QualIdent Nothing (Ident "x" 22))))))) []))]) ,(TypeSig (51,1) [(Ident "collapse" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (VariableType (Ident "a" 0)) (VariableType (Ident "a" 0))))) ,(FunctionDecl (52,1) (Ident "collapse" 0) [(Equation (52,1) (FunLhs (Ident "collapse" 0) [(VariablePattern (Ident "ref" 30)),(VariablePattern (Ident "x" 30))]) (SimpleRhs (52,18) (Apply (Variable (QualIdent (Just "Unsafe") (Ident "unsafePerformIO" 0))) (Paren (Do [(StmtBind (VariablePattern (Ident "node" 32)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 30))))),(StmtExpr (Case (Variable (QualIdent Nothing (Ident "node" 32))) [(Alt (56,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (56,20) (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "tried to collapse collapsed ref"))) [])),(Alt (57,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "p" 35)),(VariablePattern (Ident "c" 35)),(VariablePattern (Ident "s" 35))]) (SimpleRhs (57,21) (Do [(StmtBind (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "pp" 37)),(VariablePattern (Ident "pc" 37)),(VariablePattern (Ident "_" 38))]) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "p" 35))))),(StmtBind (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "_" 40)),(VariablePattern (Ident "sc" 39)),(VariablePattern (Ident "ss" 39))]) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 35))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 30)))) (Constructor (QualIdent (Just "EventOracle") (Ident "Collapsed" 0))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "p" 35)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "pp" 37)))) (Variable (QualIdent Nothing (Ident "pc" 37)))) (Variable (QualIdent Nothing (Ident "s" 35)))))))] (InfixApply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 35)))) (InfixOp (QualIdent (Just "Prelude") (Ident "$!!" 0))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "p" 35)))) (Paren (InfixApply (InfixApply (Variable (QualIdent Nothing (Ident "c" 35))) (InfixOp (QualIdent (Just "Prelude") (Ident "+" 0))) (Literal (Int (Ident "_" 41) 1))) (InfixOp (QualIdent (Just "Prelude") (Ident "+" 0))) (Variable (QualIdent Nothing (Ident "sc" 39)))))) (Variable (QualIdent Nothing (Ident "ss" 39))))))) []))]))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Variable (QualIdent Nothing (Ident "x" 30))))))) []))]) ,(TypeSig (67,1) [(Ident "closeRef" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (VariableType (Ident "a" 0)) (VariableType (Ident "a" 0))))) ,(FunctionDecl (68,1) (Ident "closeRef" 0) [(Equation (68,1) (FunLhs (Ident "closeRef" 0) [(VariablePattern (Ident "ref" 42)),(VariablePattern (Ident "x" 42))]) (SimpleRhs (68,18) (Apply (Variable (QualIdent (Just "Unsafe") (Ident "unsafePerformIO" 0))) (Paren (Do [(StmtBind (VariablePattern (Ident "node" 44)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 42))))),(StmtExpr (Case (Variable (QualIdent Nothing (Ident "node" 44))) [(Alt (72,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (72,20) (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "tried to collapse collapsed ref"))) [])),(Alt (73,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "p" 47)),(VariablePattern (Ident "c" 47)),(VariablePattern (Ident "s" 47))]) (SimpleRhs (73,21) (Do [(StmtBind (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "pp" 49)),(VariablePattern (Ident "pc" 49)),(VariablePattern (Ident "_" 50))]) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "p" 47))))),(StmtBind (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "_" 52)),(VariablePattern (Ident "sc" 51)),(VariablePattern (Ident "ss" 51))]) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 47))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 42)))) (Constructor (QualIdent (Just "EventOracle") (Ident "Collapsed" 0))))),(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "p" 47)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "pp" 49)))) (Variable (QualIdent Nothing (Ident "pc" 49)))) (Variable (QualIdent Nothing (Ident "s" 47)))))))] (InfixApply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 47)))) (InfixOp (QualIdent (Just "Prelude") (Ident "$!!" 0))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "p" 47)))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "c" 47))) (InfixOp (QualIdent (Just "Prelude") (Ident "+" 0))) (Variable (QualIdent Nothing (Ident "sc" 51)))))) (Variable (QualIdent Nothing (Ident "ss" 51))))))) []))]))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Variable (QualIdent Nothing (Ident "x" 42))))))) []))]) ,(TypeSig (85,1) [(Ident "expand" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (ListType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) [])) (ArrowType (VariableType (Ident "a" 0)) (VariableType (Ident "a" 0)))))) ,(FunctionDecl (86,1) (Ident "expand" 0) [(Equation (86,1) (FunLhs (Ident "expand" 0) [(VariablePattern (Ident "ref" 53)),(VariablePattern (Ident "refs" 53)),(VariablePattern (Ident "x" 53))]) (SimpleRhs (86,21) (Apply (Variable (QualIdent (Just "Unsafe") (Ident "unsafePerformIO" 0))) (Paren (Do [(StmtBind (VariablePattern (Ident "node" 55)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 53))))),(StmtExpr (Case (Variable (QualIdent Nothing (Ident "node" 55))) [(Alt (91,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (91,20) (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "tried to expand collapsed ref"))) [])),(Alt (92,7) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "p" 58)),(VariablePattern (Ident "c" 58)),(VariablePattern (Ident "s" 58))]) (SimpleRhs (92,21) (Do [(StmtBind (VariablePattern (Ident "last" 61)) (Apply (Apply (Apply (Paren (InfixApply (Variable (QualIdent (Just "EventOracle") (Ident "toAssocList" 0))) (InfixOp (QualIdent (Just "Prelude") (Ident "$!!" 0))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "c" 58))) (InfixOp (QualIdent (Just "Prelude") (Ident "+" 0))) (Literal (Int (Ident "_" 60) 1)))))) (Variable (QualIdent Nothing (Ident "p" 58)))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "ref" 53))) (InfixConstr (QualIdent Nothing (Ident ":" 0))) (Variable (QualIdent Nothing (Ident "refs" 53)))))) (Variable (QualIdent Nothing (Ident "s" 58))))),(StmtBind (VariablePattern (Ident "suc" 62)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 58)))))] (Case (Variable (QualIdent Nothing (Ident "suc" 62))) [(Alt (96,11) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (96,24) (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "successor of expanded ref is already collapsed"))) [])),(Alt (97,11) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "_" 66)),(VariablePattern (Ident "sc" 65)),(VariablePattern (Ident "ss" 65))]) (SimpleRhs (97,27) (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "s" 58)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "last" 61)))) (Variable (QualIdent Nothing (Ident "sc" 65)))) (Variable (QualIdent Nothing (Ident "ss" 65)))))) [])),(Alt (98,11) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Marker" 0)) []) (SimpleRhs (98,21) (Variable (QualIdent (Just "Prelude") (Ident "done" 0))) []))])) []))]))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Variable (QualIdent Nothing (Ident "x" 53))))))) []))]) ,(TypeSig (101,1) [(Ident "toAssocList" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Cost" 0)) []) (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (ListType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) [])) (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(ConstructorType (QualIdent Nothing (Ident "Ref" 0)) [])])))))) ,(FunctionDecl (102,1) (Ident "toAssocList" 0) [(Equation (102,1) (FunLhs (Ident "toAssocList" 0) [(VariablePattern (Ident "c" 70)),(VariablePattern (Ident "p" 70)),(ListPattern [(VariablePattern (Ident "r" 70))]),(VariablePattern (Ident "s" 70))]) (SimpleRhs (102,25) (InfixApply (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "r" 70)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "p" 70)))) (Variable (QualIdent Nothing (Ident "c" 70)))) (Variable (QualIdent Nothing (Ident "s" 70)))))) (InfixOp (QualIdent (Just "Prelude") (Ident ">>" 0))) (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Variable (QualIdent Nothing (Ident "r" 70))))) [])),(Equation (103,1) (FunLhs (Ident "toAssocList" 0) [(VariablePattern (Ident "c" 72)),(VariablePattern (Ident "p" 72)),(ParenPattern (InfixPattern (VariablePattern (Ident "r" 72)) (QualIdent Nothing (Ident ":" 0)) (AsPattern (Ident "rs" 72) (ParenPattern (InfixPattern (VariablePattern (Ident "r'" 72)) (QualIdent Nothing (Ident ":" 0)) (VariablePattern (Ident "_" 73))))))),(VariablePattern (Ident "s" 72))]) (SimpleRhs (103,35) (Do [(StmtExpr (Apply (Apply (Variable (QualIdent (Just "IOExts") (Ident "writeIORef" 0))) (Variable (QualIdent Nothing (Ident "r" 72)))) (Paren (Apply (Apply (Apply (Constructor (QualIdent (Just "EventOracle") (Ident "Node" 0))) (Variable (QualIdent Nothing (Ident "p" 72)))) (Variable (QualIdent Nothing (Ident "c" 72)))) (Variable (QualIdent Nothing (Ident "r'" 72)))))))] (Apply (Apply (Apply (Apply (Variable (QualIdent (Just "EventOracle") (Ident "toAssocList" 0))) (Literal (Int (Ident "_" 75) 0))) (Variable (QualIdent Nothing (Ident "r" 72)))) (Variable (QualIdent Nothing (Ident "rs" 72)))) (Variable (QualIdent Nothing (Ident "s" 72))))) []))]) ,(TypeSig (107,1) [(Ident "pointerToList" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ArrowType (ConstructorType (QualIdent Nothing (Ident "Ref" 0)) []) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(ListType (ConstructorType (QualIdent Nothing (Ident "Cost" 0)) []))])))) ,(FunctionDecl (108,1) (Ident "pointerToList" 0) [(Equation (108,1) (FunLhs (Ident "pointerToList" 0) [(VariablePattern (Ident "ref" 76)),(VariablePattern (Ident "end" 76))]) (SimpleRhs (108,25) (Do [(StmtBind (VariablePattern (Ident "node" 78)) (Apply (Variable (QualIdent (Just "IOExts") (Ident "readIORef" 0))) (Variable (QualIdent Nothing (Ident "ref" 76)))))] (Case (Variable (QualIdent Nothing (Ident "node" 78))) [(Alt (111,5) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Collapsed" 0)) []) (SimpleRhs (111,18) (InfixApply (Apply (Variable (QualIdent (Just "EventOracle") (Ident "warning" 0))) (Literal (String "final list contains collapsed reference"))) (InfixOp (QualIdent (Just "Prelude") (Ident ">>" 0))) (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (List []))) [])),(Alt (112,5) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Node" 0)) [(VariablePattern (Ident "_" 82)),(VariablePattern (Ident "c" 81)),(VariablePattern (Ident "s" 81))]) (SimpleRhs (112,19) (Do [(StmtBind (VariablePattern (Ident "cs" 84)) (Apply (Apply (Variable (QualIdent (Just "EventOracle") (Ident "pointerToList" 0))) (Variable (QualIdent Nothing (Ident "s" 81)))) (Variable (QualIdent Nothing (Ident "end" 76)))))] (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (Paren (InfixApply (Variable (QualIdent Nothing (Ident "c" 81))) (InfixConstr (QualIdent Nothing (Ident ":" 0))) (Variable (QualIdent Nothing (Ident "cs" 84))))))) [])),(Alt (115,5) (ConstructorPattern (QualIdent (Just "EventOracle") (Ident "Marker" 0)) []) (SimpleRhs (115,15) (Apply (Variable (QualIdent (Just "Prelude") (Ident "return" 0))) (List [])) []))])) []))]) ,(TypeSig (117,1) [(Ident "warning" 0)] (ArrowType (ConstructorType (QualIdent Nothing (Ident "String" 0)) []) (ConstructorType (QualIdent Nothing (Ident "IO" 0)) [(TupleType [])]))) ,(FunctionDecl (118,1) (Ident "warning" 0) [(Equation (118,1) (FunLhs (Ident "warning" 0) [(VariablePattern (Ident "msg" 87))]) (SimpleRhs (118,15) (InfixApply (Variable (QualIdent (Just "Prelude") (Ident "putStrLn" 0))) (InfixOp (QualIdent (Just "Prelude") (Ident "$" 0))) (InfixApply (Literal (String "WARNING: ")) (InfixOp (QualIdent (Just "Prelude") (Ident "++" 0))) (Variable (QualIdent Nothing (Ident "msg" 87))))) []))]) ]