Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
821a47229c
|
|||
|
f373334f77
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "purescript-csv-stream",
|
||||
"version": "v1.0.3",
|
||||
"version": "v1.0.4",
|
||||
"dependencies": {
|
||||
"csv-parse": "^5.5.5",
|
||||
"csv-stringify": "^6.4.6"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package:
|
||||
name: node-stream-pipes
|
||||
publish:
|
||||
version: '1.0.3'
|
||||
version: '1.0.4'
|
||||
license: 'GPL-3.0-or-later'
|
||||
location:
|
||||
githubOwner: 'cakekindel'
|
||||
@@ -32,7 +32,6 @@ package:
|
||||
- strings: ">=6.0.1 <7.0.0"
|
||||
- tailrec: ">=6.1.0 <7.0.0"
|
||||
- transformers: ">=6.0.0 <7.0.0"
|
||||
- tuples: ">=7.0.0 <8.0.0"
|
||||
- unsafe-coerce: ">=6.0.0 <7.0.0"
|
||||
test:
|
||||
main: Test.Main
|
||||
|
||||
18
src/Pipes.Collect.purs
Normal file
18
src/Pipes.Collect.purs
Normal file
@@ -0,0 +1,18 @@
|
||||
module Pipes.Collect where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Control.Monad.Rec.Class (class MonadRec)
|
||||
import Control.Monad.ST.Class (liftST)
|
||||
import Data.Array.ST as Array.ST
|
||||
import Effect.Class (class MonadEffect, liftEffect)
|
||||
import Pipes (for) as Pipes
|
||||
import Pipes.Core (Producer)
|
||||
import Pipes.Core (runEffect) as Pipes
|
||||
|
||||
-- | Traverse a pipe, collecting into a mutable array with constant stack usage
|
||||
collectArray :: forall a m. MonadRec m => MonadEffect m => Producer a m Unit -> m (Array a)
|
||||
collectArray p = do
|
||||
st <- liftEffect $ liftST $ Array.ST.new
|
||||
Pipes.runEffect $ Pipes.for p \a -> void $ liftEffect $ liftST $ Array.ST.push a st
|
||||
liftEffect $ liftST $ Array.ST.unsafeFreeze st
|
||||
Reference in New Issue
Block a user