I like it overall, since it seems like a nice way to bundle up operations that depend on each other without needing nested transactions (which gremlin doesn't support).
Something I'd like, but can't figure out how to implement, is to have the type parameter of GraphOp be an Xor[GraphError, A], instead of just A, and fail the transaction if the op returns an error. As it is, the GraphOp need to throw an exception to bail out, which seems not so great.
This is based on the example in this article: https://www.chrisstucchio.com/blog/2015/free_monads_in_scalaz.html
I like it overall, since it seems like a nice way to bundle up operations that depend on each other without needing nested transactions (which gremlin doesn't support).
Something I'd like, but can't figure out how to implement, is to have the type parameter of
GraphOp
be anXor[GraphError, A]
, instead of justA
, and fail the transaction if the op returns an error. As it is, theGraphOp
need to throw an exception to bail out, which seems not so great.