[rio] Suggestion for libraries based on ResourceT

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[rio] Suggestion for libraries based on ResourceT

Pablo Parga
Hi!
We are beginners using Haskell in production for less than a year and we want expand the usage in our company. We love RIO goals and we want to avoid mtl-style typeclasses as much as posible.

Right now we are relying in amazonka (based on ResourceT), is there a way to use this library avoiding mtl-style?

Thanks!

--
Reply | Threaded
Open this post in threaded view
|

Re: [rio] Suggestion for libraries based on ResourceT

Michael Snoyman
I could give more specific guidance with a concrete example. But one thing I can say in general is that, when I've needed ResourceT and am working with rio, I end up with a concrete stack of `ResourceT (RIO env)`, and type signatures that look something like:

    myFunc :: HasLogFunc env => Int -> ResourceT (RIO env) String

You could generalize that to mtl-style with:

    myFunc' :: (HasLogFunc env, MonadResource m, MonadReader env m) => Int -> m String
    myFunc' = liftResourceT . liftRIO

But of course you're looking to avoid mtl style, not embrace it :)

On Thu, Mar 8, 2018 at 7:20 PM, Pablo Parga <[hidden email]> wrote:
Hi!
We are beginners using Haskell in production for less than a year and we want expand the usage in our company. We love RIO goals and we want to avoid mtl-style typeclasses as much as posible.

Right now we are relying in amazonka (based on ResourceT), is there a way to use this library avoiding mtl-style?

Thanks!

--

--
Reply | Threaded
Open this post in threaded view
|

Re: [rio] Suggestion for libraries based on ResourceT

Pablo Parga
Thanks for the examples!

On Friday, March 9, 2018 at 10:06:10 AM UTC-3, Michael Snoyman wrote:
I could give more specific guidance with a concrete example. But one thing I can say in general is that, when I've needed ResourceT and am working with rio, I end up with a concrete stack of `ResourceT (RIO env)`, and type signatures that look something like:

    myFunc :: HasLogFunc env => Int -> ResourceT (RIO env) String

You could generalize that to mtl-style with:

    myFunc' :: (HasLogFunc env, MonadResource m, MonadReader env m) => Int -> m String
    myFunc' = liftResourceT . liftRIO

But of course you're looking to avoid mtl style, not embrace it :)

On Thu, Mar 8, 2018 at 7:20 PM, Pablo Parga <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="9xjCX_huBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">pa...@...> wrote:
Hi!
We are beginners using Haskell in production for less than a year and we want expand the usage in our company. We love RIO goals and we want to avoid mtl-style typeclasses as much as posible.

Right now we are relying in amazonka (based on ResourceT), is there a way to use this library avoiding mtl-style?

Thanks!

--

--