import { Stream , StreamWithSend } from "./Stream" ; import { Vertex , Source } from "./Vertex" ; import { Transaction } from "./Transaction" ; export class IOAction { static fromAsync < A , B > ( performIO ) { return ( sa ) => { const out = new StreamWithSend < B > ( null ) ; out . setVertex__ ( new Vertex ( "map" , 0 , [ new Source ( sa . getVertex__ ( ) , ( ) => { return sa . listen_ ( out . getVertex__ ( ) , ( a ) => { performIO ( a , ( b ) => { Transaction . run ( ( ) => { out . send_ ( b ) ; } ) ; } ) ; } , false ) ; } ) ] ) ) ; return out ; } ; } }