Created
April 28, 2019 13:37
-
-
Save etorreborre/2dc356a329e92a2df71f852cc930264c to your computer and use it in GitHub Desktop.
output-batched.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| newBatchedOutput :: (Monad m) => Tag "unbatched" (Output m) -> Output m | |
| newBatchedOutput output = Output { | |
| saveOutputs = concat . saveOutputs (unTag output). batchesOf 500 | |
| } | |
| batchesOf :: (Monad m) => Int -> Stream (Of a) m r -> Stream (Of [a]) m r | |
| batchesOf batchSize = mapsM toList . chunksOf batchSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment