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;
|
||||||
};
|
};
|
||||||
|
@ -122,15 +122,17 @@ foreach stream cb = do
|
|||||||
$ liftAff
|
$ liftAff
|
||||||
$ makeAff \res -> do
|
$ makeAff \res -> do
|
||||||
stop <- flip (Event.once columnsH) stream $ const do
|
stop <- flip (Event.once columnsH) stream $ const do
|
||||||
void $ getOrInitColumnsMap stream
|
void $ getOrInitColumnsMap stream
|
||||||
res $ Right unit
|
res $ Right unit
|
||||||
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
|
||||||
cols <- liftMaybe (error "unreachable") =<< getOrInitColumnsMap stream
|
( flip catchError (res <<< Left) do
|
||||||
record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols row
|
cols <- liftMaybe (error "unreachable") =<< getOrInitColumnsMap stream
|
||||||
launchAff_ $ flip catchError (liftEffect <<< res <<< Left) (unlift $ cb record)
|
record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols row
|
||||||
|
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