`Sys.IO` improvements / Triaged issues + fixes release
Pre-releaseSys.IO
improvement
The Sys.IO
functions were generalised to support any monad that has the correct Has
traits. However, this added a burden to any users of Eff
and Aff
from v4
of language-ext.
For example, this in v4
:
Console<RT>.writeLine(text)
Would become this in v5
:
Console<Eff<RT>, RT>.writeLine(text)
That works well when you're write entirely generalised IO code, like you see in the Newsletter
sample project.
Writing this:
Console<M, RT>.writeLine(text)
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 added Eff
specific versions for every static class in the Sys
library.
So, for example, as well as Console<M, RT>
, there is also a Console<RT>
which only works with the Eff<RT, A>
monad. This allows existing code that uses Eff<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
- The
ToEnumerable
extension forFoldable
has been renamed toToIterable
(it was missed on the previous refactor) StreamT
internals made lazy- Allows the removal of bespoke types that deal only with
IEnumerable
andIAsyncEnumerable
- Allows the removal of bespoke types that deal only with
HeadUnsafe
removed fromStreamT
HeadOrFail
extension toStreamT
added. Only works withFallible
monads.
- Fix for FileIO move missing? #1174
- Removed
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
- There's an outstanding bug that needs resolving
- You can see how it will work in the
Streams
sample