Skip to content

Improving Composability in my codebase #1454

Answered by aloslider
rhemsuda asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Eff<Either<Error, JobExecutionData>> is redundant, Eff<T> is already using Fin<T> which is basically an Either<Error, T>.
  2. Based on the code I see there are a plenty of monad transofmations (usually Option, Either and Eff). If you are using v4, there are some built in functions to transform, say, Option to Eff. If you are using v5, there are monad transformers that you can use, which simplifies working with different stacks even more and giving you a way to build you own domain monad.
  3. If you step a little bit and try to look at your example again, you may see some overcomplexification:
liftEff(async () => 
            Optional(await context.JobExecutions.FindAsync(name.Value, executionDate)

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rhemsuda
Comment options

You must be logged in to vote
1 reply
@louthy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants