let List := requireModule "List" in let Error := requireModule "Error" in let Composition := requireModule "Composition" in let Logic := requireModule "Logic" in import [rec (|) ($) rem] from Composition in import [head tail] from List in import [(if) (else)] from Logic in let ioValue := (\m head m) in let ioWorld := (\m head (tail m)) in let (;) := \m \ber \world let r := (m world) in ber (ioValue r) (ioWorld r) in let liftIO! := (\v \world [v world]) in let return! := liftIO! in let skipUntil! := (\condition \body rec\skipUntil! \world let result := body world in if (condition (ioValue result)) result else skipUntil! (ioWorld result) ) in let skipWhile! := (\condition \body rec\skipWhile! \world let result := body world in if (condition (ioValue result)) skipWhile! (ioWorld result) else result ) in let accumrUntil! := (\condition \connector \terminator \body rec\accum! \world let result := body world in let value := ioValue result in if (condition value) liftIO! terminator (ioWorld result) else let t := (accum! (ioWorld result)) in let value2 := ioValue t in liftIO! (connector value value2) (ioWorld t) ) in let defer! := \finalizer \body rem "Following tradition, this ignores the result of the finalizer."$ \world let result := body world in let value := ioValue result in let world2 := ioWorld result in let result2 := finalizer world2 in let world3 := ioWorld result2 in liftIO! value world3 in let with! := \opener \closer \body opener ;\f defer! (closer f) (body f) in (requireModule "Composition").dispatch1 (#exports[ioValue ioWorld liftIO! return! (;) skipUntil! skipWhile! accumrUntil! defer! with!])