Open NicolasT opened 1 year ago
My bad, using liftIO
and withRunInIO
, it is possible to use catch
and whatnot, and hence achieve what I was after, but it feels a bit complicated v.s. having MonadCatch
etc. available.
I prefer to keep a minimal dependency footprint. The unliftio
package handles most of the standard-library-ish combinators like bracket
, catch
, async
, etc. And for libraries like network-simple
, it's possible to define orphan Monad{Throw,Catch,Mask}
instances for Actor
via the underlying ReaderT
.
Also, drama
is mostly a toy/experimental library right now; there's lots of stuff which is missing or incorrect. I wouldn't use it for anything serious.
That said, I'll consider depending on exceptions
in the future.
Well, unliftio
uses/depends on safe-exceptions
, which pulls in exceptions
anyway (it uses the very same Monad{Throw,Catch,Mask}
classes), so there wouldn't really be an extra dependency, only an extra direct dependency :wink:
Sure, and orphan instance can be created (that's what I do right now), but I prefer to avoid those whenever possible.
drama
depends on unliftio-core
(contains just the MonadUnliftIO
type class), not unliftio
(contains lots of standard library stuff).
:facepalm:
Since the
Actor
monad is basically aReaderT
, do you think it'd be possible to add instances forexception
'sMonadThrow
,MonadCatch
andMonadMask
? Of course, exception handling ought to be handled a bit different in an actor-style architecture, but being able to usebracket
(and similar) to manage resources is quite important nonetheless.As an example, currently I don't believe it's possible to write an actor which uses
network-simple
'slisten
andaccept
, to thencast
any new client socket to some manager actor.