Leo Gorodinski
@eulerfx
val service : Input -> Output
type Input =
| AddItem of productId:string
| RemoveItem of productId:string
type Output =
| ItemAdded of productId:string
| ItemRemoved of productId:string
let service input : Input -> Output =
match input with
| AddItem productId -> ItemAdded productId
| RemoveItem productId -> ItemRemoved productId
type Input =
| AddItem of productId:string
| RemoveItem of productId:string
type Output =
| ItemAdded of productId:string
| ItemRemoved of productId:string
let service input : Input -> Async<Output> =
async {
do! Async.Sleep 1000
match input with
| AddItem productId -> return ItemAdded productId
| RemoveItem productId -> return ItemRemoved productId }
type Input =
| AddItem of productId:string
| RemoveItem of productId:string
type Output =
| ItemAdded of productId:string
| ItemRemoved of productId:string
let service (d:string) input : string -> Input -> Async<Output> =
async {
do! Async.Sleep 1000
printfn "hello=%s" d
match input with
| AddItem productId -> return ItemAdded productId
| RemoveItem productId -> return ItemRemoved productId }
type Conn = IEventStoreConnection
type Stream = string
type From = int
val write : Conn -> Stream -> EventData -> Async<unit>
val read : Conn -> Stream -> From -> int -> Async<StreamEventSlice>
val exec : Input * State -> Output
val apply : Output * State -> State
let T (input,state) : Input * State -> Output * State =
let output = exec (input,state)
let state' = apply (output,state)
(output,state')
Leo Gorodinski
@eulerfx