transient-haskell / transient

A full stack, reactive architecture for general purpose programming. Algebraic and monadically composable primitives for concurrency, parallelism, event handling, transactions, multithreading, Web, and distributed computing with complete de-inversion of control (No callbacks, no blocking, pure state)
MIT License
630 stars 28 forks source link

Add transformers support to transient #59

Closed harendra-kumar closed 7 years ago

harendra-kumar commented 7 years ago

Transient now implements a transformer monad named AsyncT that provides composition of asynchronous effects on top of any monad that implements MonadIO. It can be used anywhere in a transformer stack. I might add a few more commits with minor changes (e.g. exporting the transformer interface, renaming of fields etc.), but this commit captures the essence of the change.

TransIO is now implemented as AsyncT IO. There is no change in external APIs except that now you have to use a new setSData API in place of setData inside TransIO, just like getSData for get operation. This will require a version bump.

The change consists of largely signature changes. I have tried to keep the changes to a minimum in this commit to help in review. The significant changes are:

1) Add the transformer base monad as an existential variable EventF 2) A few more unsafeCoerces for the continuation type conversions 3) lowering of monad computations into IO to facilitate forkIO for new event creation. This requires monad-control and lifted-base.

harendra-kumar commented 7 years ago

Closing this after discussing with @agocorona. Transient avoids transformers for simplicity and beginner friendliness. I am however experimenting with transformers support and some other stuff in a separate fork for now.