fix: ??
This commit is contained in:
parent
8e842feeef
commit
499eb82986
@ -12,7 +12,7 @@ export const makeImpl = (c) => () => {
|
|||||||
const parser = new ParserWithColumns(c);
|
const parser = new ParserWithColumns(c);
|
||||||
parser.once("readable", () => {
|
parser.once("readable", () => {
|
||||||
parser.columns = parser.read();
|
parser.columns = parser.read();
|
||||||
parser.emit('columns', parser.columns)
|
parser.emit("columns", parser.columns);
|
||||||
});
|
});
|
||||||
return parser;
|
return parser;
|
||||||
};
|
};
|
||||||
|
@ -127,10 +127,12 @@ foreach stream cb = do
|
|||||||
pure $ Canceler $ const $ liftEffect stop
|
pure $ Canceler $ const $ liftEffect stop
|
||||||
|
|
||||||
liftAff $ makeAff \res -> do
|
liftAff $ makeAff \res -> do
|
||||||
removeDataListener <- flip (Event.on dataH) stream \row -> launchAff_ $ delay (wrap 0.0) <* liftEffect do
|
removeDataListener <- flip (Event.on dataH) stream \row -> launchAff_ $ delay (wrap 0.0) <* liftEffect
|
||||||
|
( flip catchError (res <<< Left) do
|
||||||
cols <- liftMaybe (error "unreachable") =<< getOrInitColumnsMap stream
|
cols <- liftMaybe (error "unreachable") =<< getOrInitColumnsMap stream
|
||||||
record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols row
|
record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols row
|
||||||
launchAff_ $ flip catchError (liftEffect <<< res <<< Left) (unlift $ cb record)
|
launchAff_ $ flip catchError (liftEffect <<< res <<< Left) (unlift $ cb record)
|
||||||
|
)
|
||||||
removeEndListener <- flip (Event.once Stream.endH) stream (res $ Right unit)
|
removeEndListener <- flip (Event.once Stream.endH) stream (res $ Right unit)
|
||||||
removeErrorListener <- flip (Event.on Stream.errorH) stream (res <<< Left)
|
removeErrorListener <- flip (Event.on Stream.errorH) stream (res <<< Left)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user