Closed jgrund closed 7 years ago
Well it depends from what you need. If you don't want to write a library from scratch, the easy path is to port an existing library from a functional language, for example
https://github.com/purescript-node/purescript-node-streams https://github.com/Fresheyeball/elm-node
So, what's interesting about the implementation of:
https://github.com/purescript-node/purescript-node-streams/blob/master/src/Node/Stream.purs#L66
Is it encodes effects for things like Read
and Write
.
It seems slightly different in flow in that we already know if something is a readable or writable due to the libdefs: https://github.com/facebook/flow/blob/master/lib/node.js#L1181
which we can import as types and use as well.
I guess it makes more sense in the PureScript implementation where they model a base Stream type and add effects for reading / writing etc..
I wonder if effects are better suited in this case for business logic type things, or things the type system can't already tell us.
Just a general question, how would one go about handling things like Node streams with this lib?