import * as React from "react" import * as ReactDOM from "react-dom" import {List, Map, Set} from "immutable" import * as Immutable from "immutable" import * as Moment from 'moment' import {C, unit, bind} from '../react_monad/core' import {string, number, bool} from '../react_monad/primitives' import {button, selector, multi_selector, label, image} from '../react_monad/html' import {custom, repeat, any, lift_promise, retract, delay, simple_menu} from '../react_monad/combinators' import * as Form from '../react_monad/forms' export type WorkflowData = { model:M, step:S } export let simple_workflow = function(workflow_name:string, steps:Immutable.Map) => C>>, initial_model:C, initial_step:S) : C { return initial_model.then(`${workflow_name}_initial_binder`, m => repeat>(`${workflow_name}_repeater`)(cd => steps.has(cd.step) ? steps.get(cd.step)(cd) : unit>(cd).filter(_ => false) )({ model: m, step:initial_step }).map(c => c.model)) }