WIP: Sketch of most simple bifunctor extension#197
WIP: Sketch of most simple bifunctor extension#197johnynek wants to merge 1 commit intotypelevel:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #197 +/- ##
==========================================
- Coverage 89.69% 89.19% -0.51%
==========================================
Files 50 53 +3
Lines 1087 1092 +5
Branches 77 77
==========================================
- Hits 975 974 -1
- Misses 112 118 +6 |
|
Note, Fiber and Bracket already seem okay, and would not need to change. Also, we can give an implementation of all the typeclasses for We would need to weaken the Sync laws. Perhaps we say that |
|
Of course, this isn’t really forcing a bifunctor on anything unless we require Then we get where we want with a def attempt[E, A](f: F[E, A]): F[Nothing, Either[E, A]] |
|
Thanks for getting something concrete out here so quickly!
|
| * the purpose of this function is to suspend side effects | ||
| * in `F`. | ||
| */ | ||
| def delay[A](thunk: => A): F[A] = suspend(pure(thunk)) |
There was a problem hiding this comment.
The problem with this is that it no longer catches any errors, so F.delay(throw e) can't safely deal with errors :/
There was a problem hiding this comment.
Doh, of course I'm now realizing you've already talked about that 😂 sorry! Disregard
|
FWIW I have a WIP branch for unexceptional type classes for #176, that could help with this, I can push this later today :) |
|
This is a good start, but I'd like to cleanup the issue tracker a bit, otherwise important issues can get lot in noise. We'll probably get back to it, but let's close this for now. |
a sketch of what #189 might look like in a source compatible way.
Missing steps:
IO[A] = bifunctor.IO[Throwable, A]If you want to work with no errors, you can fix
E = Nothingand then you know thatEither[Nothing, A] == Awhich we can give an implementation of:If you want to use Unit or String, everything goes through.
I guess all the typeclasses are InvariantFunctors in E, so we can give those too if people want to perhaps give some embedding from
E <=> Throwablewhich I guess can be done for some Es.