Write your AWS DevOps tool in Haskell for Great Good

submited by
Style Pass
2021-08-16 10:30:04

Of course the Haskell code is pure and lazy, so send just returns a data that describes the command and produce no side effect, to actually exec the command we can create a function awsRun to execute the command:

–page-size (integer) The number of results to return in each response to a list operation. The default value is 1000 (the maximum allowed) https://docs.aws.amazon.com/cli/latest/reference/s3/ls.html#options

Simply replace send with paginate, amazonka will automatically pull objects into a Conduit https://github.com/snoyberg/conduit stream, you can simply map over the stream, .| takeC 3 to go over only first 3 pages, or even .| sinkList to load the very large list into memory.

I guess anyone even can't read Haskell at all can identify the Haskell version is basically the same as AWS CLI, with some simple syntax mapping you can instantly translate any AWS CLI command into Haskell code.

Leave a Comment