plow-technologies / servant-streaming

Support for servant requests and responses via the 'streaming' library
13 stars 3 forks source link

Get rid of StreamBodyMonad #11

Open domenkozar opened 6 years ago

domenkozar commented 6 years ago

Main motivation is that at the moment, api type includes the monad in which server operates, which is really not a property of the api.

Two options (with help of @roberth):

a) open type family to specify the monad and user has to provide instances

b) use server context to specify the monad in which api operates

jkarni commented 6 years ago

Main motivation is that at the moment, api type includes the monad in which server operates, which is really not a property of the api.

Sounds like a good idea. I had never thought of using the context as a way of supplying a type proxy to the instances - quite nifty! I think both a) and b) sound reasonable, but b) is nicer in that it doesn't force you to make global decisions - you could in theory have one part of the API operating on one monad, and another in another, by changing the context.