Aff and Eff monad updates (breaking changes)
I've done some refactoring of the Aff
and Eff
monads as I slowly progress toward a v4.0
release of language-ext:
RunIO
has been renamed toRun
HasCancel
has been rationalised to only use non-Eff and non-Aff properties- It was a mistake to use them, I should have just used regular properties and then made access via static functions
- This has now been done and should make it a bit more obvious how to use when building your own runtimes
- Support for
MapAsync
on theEff
monads- That means we don't need both a
Aff
andEff
property in theHas*
traits, as anEff
can beMapAsync
d into anAff
efficiently - So traits now should only return something like
Eff<RT, FileIO> FileEff
(obviously different types based on your trait)
- That means we don't need both a
- The wrappers for the .NET
System
namespace have now been factored out into a new libraryLanguageExt.Sys
- The naming wasn't great, and it was clear it was going to get pretty messy as I wrapped more of the
System
IO operations - Also, there's a chance you wouldn't want to use the implementations I have built, so having the main namespace cluttered with IO traits and types that you might not need was a bit ugly.
- The naming wasn't great, and it was clear it was going to get pretty messy as I wrapped more of the
- The default 'live' runtime has also been factored out
- A new test runtime has been added - for unit testing
- A new built-in mocked in-memory file-system - this allows unit tests to work with files without having to physically create them on a disk
- A new built-in mocked in-memory console - this allows unit tests to mock key-presses in a console, as well as the option the look at the in-memory console buffer to assert correct values being written
- A time provider - allows the system clock to appear to run from any date, or even be frozen in time
- An in-memory mocked 'System.Environment'
Finally, I'm starting to document the Aff
and Eff
usage. This will be fleshed out more over the next few weeks.
All deployed to nu-get now.