Repository navigation
remove Ops classes - #1114
remove Ops classes#1114
Conversation
| fr: Frame | ||
| ): B < (Abort[Nothing] & S & S1) = | ||
| Abort.fold(onSuccess, onFail)(effect) | ||
| Abort.fold[E](onSuccess, onFail)(effect) |
There was a problem hiding this comment.
The explicit type parameter here shouldn't be necessary. It seems the issue is the use of Reducible. Considering that Abort[Nothing] is included in IO and derived effects, I think we can remove Reducible. It'll simplify type inference and improve compilation errors for type mismatches. The error messages with Reducible can be cryptic. I'm planning to follow up on that. Let me know if you have concerns @hearnadam @johnhungerford
There was a problem hiding this comment.
When you say we can remove it, do you mean entirely or just from Abort? Env still uses Reducible, correct?
There was a problem hiding this comment.
Good point! I forgot about Env. It'd be only the Abort-related ones
There was a problem hiding this comment.
No luck removing Reducible from Abort. We need to be able to fully handle Abort in the APIs that handle panics anyway
Problem
We used to use
Opsclasses to encode methods with multiple type parameter groups. The latest versions of the compiler include the new clause interleaving feature that provides a similar mechanism. I was initially reluctant to adopt it because I thought it could make it harder for people reading the codebase to understand the method signatures but there are important drawbacks with the currentOpsclasses:pipewith methods usingOpsclasses requires an explicit function. For instance,a.pipe(Abort.run)doesn't compile buta.pipe(Abort.run(_))does.Opsclasses makes the code less readableSolution
Migrate the all
Opsclasses to clause interleaving. To have some consistency, I used theFrameas the implicit to separate type parameter groups since the compiler currently requires parameters between type parameter groups.Notes