aristidb / aws

Amazon Web Services for Haskell
BSD 3-Clause "New" or "Revised" License
237 stars 107 forks source link

AWS Monad Transformer #30

Open aristidb opened 12 years ago

aristidb commented 12 years ago

When I started working on aws a while ago, I wanted to put everything in a monad. This plan was scrapped fairly quickly, however now I have plans to have another go, albeit with different motivations. Two things first:

  1. This will be optional: I have no plans at all to make people put their programs in an AWS monad. The plan is that complex functionality that spans multiple REST request yet is logically one AWS "call" uses this, for the most part.
  2. This will be based on FreeT (http://hackage.haskell.org/package/free or http://hackage.haskell.org/package/transformers-free) or something similar, in order to allow different "run" functions.

So why do I want this?

Originally, I just wanted to avoid giving the configuration / service configuration / HTTP manager parameters every time. But that isn't really a good reason IMHO.

I have recently started adding the first "complex" functionality to aws, inspired by @larskuhtz, specifically the IteratedTransaction functions awsIteratedSource and awsIteratedList. They just hammer out the HTTP requests and that's that. But what if we want to do things like:

Or perhaps fancier things that I haven't thought of yet.

I think there might be two components to this:

  1. A reader-like part where the configuration / HTTP Manager is stored. This part could be omitted, if somebody thinks it's a bad idea.
  2. A FreeT-like part for the actions.

It would also have to be a transformer so there can be actions in some underlying monad.

And of course it would have pluggable interpreters, which can then implement request retry / rate limiting / ....

aristidb commented 9 years ago

Random thought of the day: Allow people to use their existing MonadReader instances, with a helper class to extract AWS environment information.