Closed wmaurer closed 5 years ago
@wmaurer I think you mean TaskEither
?
Yes you can for example you can lift any TaskEither
value by using
// lift from MiddlewareTask
lift<StatusOpen, Either<Error, string>>(someTaskEither.value);
or if you want access the Conn
you can use
new MiddlewareTask(c => myRetuningTaskEitherFn(c).value.map(r => tuple(r, c)))
your last question about MiddlewareTaskEither
would be very interesting. @gcanti do you have any thoughts about it? Would it be possible? Would it need something like an ifold
function?
@mlegenhausen Yeah, theoretically it would be possible. It would mean to define MonadMiddleware4
, InducedMonad4
, IxMonad4
etc... and then a MonadMiddleware4
instance for TaskEither
@mlegenhausen I'm thinking of simplify the architecture and drop tagless final in favour of a single concrete instance, likely a ReaderTaskEither
instance. What do you think?
@gcanti I have never used the tagless feature at all. Testing is already easy with the concrete instances. TaskEither
should be minimum, cause of the great error handing capabilities. How would the environment of the Reader
part look like?
Nice to hear that hyper-ts
will be developed further. Its currently my default framework for middleware development. Do you plan other features?
Testing is already easy with the concrete instances
Yeah, that's what I thought as well.
How would the environment of the Reader part look like?
I am torn between TaskEither
and ReaderTaskEither
.
Let's start from TaskEither
, I'll send a PR based on https://github.com/gcanti/hyper-ts/pull/14 so we can discuss an actual implementation.
readertaskeither would help a lot structuring dependencies. (the zio way) However, stacking the transformers has a cost..
A complete n00b question, here as I am really struggling and I can't find any usage of
hyper-ts
in 'real life'.Is it possible to use
MiddlewareTask
withTaskEither
orReaderTaskEither
? Or would I have to define aMiddlewareTaskEither
? (which I think is beyond my current capability).Thanks for any help.
EDIT: fixed spelling
TaskReader
->TaskEither