You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeGraphBuilder(b: GraphDsl.Builder<_>)=member__.Return x = x
member__.Yield x = x
member__.Bind(m,f)= f(b.Add(m))[<AutoOpen>]moduleGraphBuilder =letgraph= GraphBuilder
letpartition(evens:Flow<int,'a,_>)(odds:Flow<int,'a,_>)=
Graph.create (fun b ->
graph b {let!p= Partition(2,fun x ->if x %2=0then0else1)let!merge= Merge<_>(2)
b.From(p.Out 0).Via(evens).To(merge.In 0)
b.From(p.Out 1).Via(odds).To(merge.In 1)return FlowShape(p.In, merge.Out)})
It works, but I don't like how Graph.create (fun b -> graph b { ... }) looks :( Also, I'd like to add custom operations so the following would be possible:
graph b {let!p= Partition(2,fun x ->if x %2=0then0else1)let!merge= Merge<_>(2)
from (p.Out 0)
via evens
to(merge.In 0)return FlowShape(p.In, merge.Out)}
(I've failed so far).
The text was updated successfully, but these errors were encountered:
Great idea :) With custom operations, maybe we'd be able to completely remove builder and keep it implicit inside the computation expression itself. I was thinking about something like:
graph {let!p= Partition(2,fun x ->if x %2=0then0else1)let!merge= Merge<_>(2)
connect (p.Out 0=> evens => merge.In 0)return FlowShape(p.In, merge.Out)}
yes, I thought about hiding the builder, but I cannot see how to obtain one inside the CE since it does not have public ctor and the only way to get it is inside lambda passed to Graph.create.
It works, but I don't like how
Graph.create (fun b -> graph b { ... })
looks :( Also, I'd like to add custom operations so the following would be possible:(I've failed so far).
The text was updated successfully, but these errors were encountered: