From 559967d7a74784efef1dbc851e5d419724e5f7dd Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Fri, 3 May 2024 13:55:16 -0500 Subject: [PATCH] fix: scheduler nonsense --- src/Node.Stream.CSV.Parse.purs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Node.Stream.CSV.Parse.purs b/src/Node.Stream.CSV.Parse.purs index d3b3e19..ec6f6ef 100644 --- a/src/Node.Stream.CSV.Parse.purs +++ b/src/Node.Stream.CSV.Parse.purs @@ -19,10 +19,11 @@ import Data.Foldable (for_) import Data.Map (Map) import Data.Map as Map import Data.Maybe (Maybe(..)) +import Data.Newtype (wrap) import Data.Nullable (Nullable) import Data.Nullable as Nullable import Effect (Effect) -import Effect.Aff (Canceler(..), launchAff_, makeAff) +import Effect.Aff (Canceler(..), delay, launchAff_, makeAff) import Effect.Aff.Class (class MonadAff, liftAff) import Effect.Aff.Unlift (class MonadUnliftAff, UnliftAff(..), askUnliftAff) import Effect.Class (liftEffect) @@ -117,7 +118,7 @@ foreach foreach stream cb = do UnliftAff unlift <- askUnliftAff liftAff $ makeAff \res -> do - removeDataListener <- flip (Event.on dataH) stream \row -> do + removeDataListener <- flip (Event.on dataH) stream \row -> launchAff_ $ delay (wrap 0.0) <* liftEffect do cols <- getOrInitColumnsMap stream for_ cols \cols' -> do record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols' row