wip: explore removing delays(3)
This commit is contained in:
parent
f9446c97a0
commit
a347c05062
@ -12,6 +12,9 @@ export const isClosedImpl = (s) => () => s.closed;
|
|||||||
/** @type {(s: Stream.Writable | Stream.Transform) => () => boolean} */
|
/** @type {(s: Stream.Writable | Stream.Transform) => () => boolean} */
|
||||||
export const isWritableImpl = (s) => () => s.writable;
|
export const isWritableImpl = (s) => () => s.writable;
|
||||||
|
|
||||||
|
/** @type {(s: Stream.Writable | Stream.Transform) => () => boolean} */
|
||||||
|
export const needsDrainImpl = (s) => () => s.writableNeedDrain;
|
||||||
|
|
||||||
/** @type {(s: Stream.Readable | Stream.Transform) => () => boolean} */
|
/** @type {(s: Stream.Readable | Stream.Transform) => () => boolean} */
|
||||||
export const isReadableEndedImpl = (s) => () => s.readableEnded;
|
export const isReadableEndedImpl = (s) => () => s.readableEnded;
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ foreign import isWritableImpl :: forall s. s -> Effect Boolean
|
|||||||
foreign import isReadableEndedImpl :: forall s. s -> Effect Boolean
|
foreign import isReadableEndedImpl :: forall s. s -> Effect Boolean
|
||||||
foreign import isWritableEndedImpl :: forall s. s -> Effect Boolean
|
foreign import isWritableEndedImpl :: forall s. s -> Effect Boolean
|
||||||
foreign import isClosedImpl :: forall s. s -> Effect Boolean
|
foreign import isClosedImpl :: forall s. s -> Effect Boolean
|
||||||
|
foreign import needsDrainImpl :: forall s. s -> Effect Boolean
|
||||||
foreign import readableLengthImpl :: forall s. s -> Effect Int
|
foreign import readableLengthImpl :: forall s. s -> Effect Int
|
||||||
|
|
||||||
readResultFFI :: forall a. ReadResultFFI a
|
readResultFFI :: forall a. ReadResultFFI a
|
||||||
@ -89,6 +90,7 @@ class Stream s <= Read s a | s -> a where
|
|||||||
|
|
||||||
class Stream s <= Write s a | s -> a where
|
class Stream s <= Write s a | s -> a where
|
||||||
isWritable :: s -> Effect Boolean
|
isWritable :: s -> Effect Boolean
|
||||||
|
needsDrain :: s -> Effect Boolean
|
||||||
isWritableEnded :: s -> Effect Boolean
|
isWritableEnded :: s -> Effect Boolean
|
||||||
write :: s -> a -> Effect WriteResult
|
write :: s -> a -> Effect WriteResult
|
||||||
end :: s -> Effect Unit
|
end :: s -> Effect Unit
|
||||||
@ -114,16 +116,19 @@ instance Write (Writable a) a where
|
|||||||
isWritableEnded = isWritableEndedImpl
|
isWritableEnded = isWritableEndedImpl
|
||||||
write s = writeImpl writeResultFFI s
|
write s = writeImpl writeResultFFI s
|
||||||
end = endImpl
|
end = endImpl
|
||||||
|
needsDrain = needsDrainImpl
|
||||||
else instance Write (Transform a b) a where
|
else instance Write (Transform a b) a where
|
||||||
isWritable = isWritableImpl
|
isWritable = isWritableImpl
|
||||||
isWritableEnded = isWritableEndedImpl
|
isWritableEnded = isWritableEndedImpl
|
||||||
write s = writeImpl writeResultFFI s
|
write s = writeImpl writeResultFFI s
|
||||||
end = endImpl
|
end = endImpl
|
||||||
|
needsDrain = needsDrainImpl
|
||||||
else instance (Write s a) => Write s a where
|
else instance (Write s a) => Write s a where
|
||||||
isWritable = isWritableImpl
|
isWritable = isWritableImpl
|
||||||
isWritableEnded = isWritableEndedImpl
|
isWritableEnded = isWritableEndedImpl
|
||||||
write s a = write s a
|
write s a = write s a
|
||||||
end s = end s
|
end s = end s
|
||||||
|
needsDrain = needsDrainImpl
|
||||||
|
|
||||||
withErrorST :: forall s. Stream s => s -> Effect { cancel :: Effect Unit, error :: STRef Global (Maybe Error) }
|
withErrorST :: forall s. Stream s => s -> Effect { cancel :: Effect Unit, error :: STRef Global (Maybe Error) }
|
||||||
withErrorST s = do
|
withErrorST s = do
|
||||||
|
Loading…
Reference in New Issue
Block a user