[rio] Suggestion for libraries based on ResourceT

18 views
Skip to first unread message

Pablo Parga

unread,
Mar 8, 2018, 12:35:18 PM3/8/18
to Commercial Haskell
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!

Michael Snoyman

unread,
Mar 9, 2018, 8:06:10 AM3/9/18
to Pablo Parga, Commercial Haskell
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 :)

--
You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commercialhaskell+unsubscribe@googlegroups.com.
To post to this group, send email to commercialhaskell@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/484cf713-3032-42d3-95c1-cee0d4d6f684%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pablo Parga

unread,
Mar 9, 2018, 1:33:59 PM3/9/18
to Commercial Haskell
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 <pa...@rocketad.co> 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!

--
You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commercialhask...@googlegroups.com.
To post to this group, send email to commerci...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages