Skip to content

v0.6.0

Compare
Choose a tag to compare
@SandroMaglione SandroMaglione released this 06 May 10:03
· 101 commits to main since this release
46f28a1
  • Do notation #97 (Special thanks to @tim-smart 🎉)
    • All the main types now have a Do() constructor used to initialize a Do notation chain
    • Updated examples to use Do notation (new recommended API 🎯)
/// Without the Do notation
String goShopping() => goToShoppingCenter()
    .alt(goToLocalMarket)
    .flatMap(
      (market) => market.buyBanana().flatMap(
            (banana) => market.buyApple().flatMap(
                  (apple) => market.buyPear().flatMap(
                        (pear) => Option.of('Shopping: $banana, $apple, $pear'),
                      ),
                ),
          ),
    )
    .getOrElse(
      () => 'I did not find 🍌 or 🍎 or 🍐, so I did not buy anything 🤷‍♂️',
    );
/// Using the Do notation
String goShoppingDo() => Option.Do(
      ($) {
        final market = $(goToShoppingCenter().alt(goToLocalMarket));
        final amount = $(market.buyAmount());

        final banana = $(market.buyBanana());
        final apple = $(market.buyApple());
        final pear = $(market.buyPear());

        return 'Shopping: $banana, $apple, $pear';
      },
    ).getOrElse(
      () => 'I did not find 🍌 or 🍎 or 🍐, so I did not buy anything 🤷‍♂️',
    );
  • Added new IOOption type
  • Added conversion methods from and to all classes (IO, IOOption, IOEither, Task, TaskOption, TaskEither)
    • Removed toTask in IOEither (use toTaskEither instead) ⚠️
  • Improved performance of fpdart's sortBy list extension #101 (thanks to @hbock-42 🎉)
  • Updated pokeapi_functional example to Riverpod v2 #99 (thanks to @utamori 🎉)
  • Updated repository folder structure #105