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
Hi, first of all apologies for the delay, I just noticed this!
First of all, I'm wondering if you can't compose the initial interpreters because you are using different types on the natural transformation: CaptchaOps ~> FuturevsNotifyOps ~> Lambda[A => Future[Either[Error, A]]]. This could be the reason of your error, try build both to Futureand theextends CaptchaOps[Either[Error, Unit]]in the case class will provide theEitheras theA` received in the natural transformation. Should work.
Second, as an alternative to compose languages, look at https://github.com/ProjectSeptemberInc/freek . It will simplify the boilerplate and the examples may help you build the stack you want
Thank you for writing an excellent article about
Free Monad
I try to apply this pattern to my current projects and face a problem.
Business flow:
A user input a correct captcha then system will send a mail.
DSL:
I can't compose
captchaOpsInterpreter
andnotifyOpsInterpreter
altogether because their context is not the same.The context of
captchaOpsInterpreter
isFuture
The context of
notifyOpsInterpreter
isFuture[Either[Error, ?]]]
I try to unify the context and use
EitherT
Passed compiling check but I got a runtime error
I find out that Captcha DSL I defined makes me hard to unify their context to
Future[Either[Error, ?]]]
I modify Captcha DSL and can unify their context easily:
Question:
CaptchaOps
doesn't express the intention: If validated successfully returnUnit
; If validated failed returnError
CaptchaOps
makes me hard to unify their context toFuture[Either[Error, ?]]]
.If I define error handling in DSL, then I'll face:
Monad transformer
to get resultIf I don't define error handling in DSL, I'm afraid that DSL doesn't express its intention.
I want to know your suggestion :>
The text was updated successfully, but these errors were encountered: