Sys.IO
improvements / Triaged issues + fixes release
#1389
louthy
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sys.IO
improvementThe
Sys.IO
functions were generalised to support any monad that has the correctHas
traits. However, this added a burden to any users ofEff
andAff
fromv4
of language-ext.For example, this in
v4
:Would become this in
v5
:That works well when you're write entirely generalised IO code, like you see in the
Newsletter
sample project.Writing this:
Is clearly not much worse than before. And adds lots of possibilities for writing your IO functions once and have them work with all IO based monads. But, this
Console<Eff<RT>, RT>.writeLine(text)
is quite ugly to look at in my humble opinion. There's too much clutter and it shows up on every line of IO you write, which doesn't feel good.So, as
Eff<RT, A>
is an important type for doing dependecy-injection based IO, I have addedEff
specific versions for every static class in theSys
library.So, for example, as well as
Console<M, RT>
, there is also aConsole<RT>
which only works with theEff<RT, A>
monad. This allows existing code that usesEff<RT, A>
to work without a change.I'm not a huge fan of doubling up the work like this, but I think this is a pragmatic solution that works without much drama.
Fixes and Updates:
Unit
made into aMonoid
Option<A>
made into aMonoid
ToEnumerable
extension forFoldable
has been renamed toToIterable
(it was missed on the previous refactor)StreamT
internals made lazyIEnumerable
andIAsyncEnumerable
HeadUnsafe
removed fromStreamT
HeadOrFail
extension toStreamT
added. Only works withFallible
monads.MemoryFS
, replaced with use of/tmp
as a virtual file-system. Fixes:Additions, but not ready for primetime
Source<A>
- a source of events that can be subscribed to. Subscriptions yield aStreamT
Streams
sampleThis discussion was created from the release `Sys.IO` improvements / Triaged issues + fixes release.
Beta Was this translation helpful? Give feedback.
All reactions