Skip to content

Aff<RT, T> or Aff<T> with different Error Type #1253

Closed Answered by louthy
timmi-on-rails asked this question in Q&A
Discussion options

You must be logged in to vote

I don't want to create too much boiler-plate nor do I want to loose too much utility on existing implementations.

The easiest way is to derive a type from Expected or Exceptional (which both derive from Error) and then use that as your error type. That requires no changes and can be done with the existing Eff and Aff types.

Otherwise - if you desperately need to constrain the type of error - there are no shortcuts unfortunately. It's quite some effort to implement these types (to make them useful). Believe me, I wish it was easier!

The closest type would be:

Reader<RT, Either<E, A>>

But even with that definition the support functions are not there, so you'd need to write them by hand.

T…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by timmi-on-rails
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants