elemental 0.1.2 copy "elemental: ^0.1.2" to clipboard
elemental: ^0.1.2 copied to clipboard

A toolkit for writing software in dart. Effect-system, dependency management and more!

A toolkit for writing software in dart

Includes:

Usage #

The ZIO<R, E, A> type represents an synchronous or asynchronous operation.

  • The R generic is for representing the requirements / environment
  • The E generic is for representing errors
  • The A generic is for the success type

There are a handful of helpful methods to ease composition!

import 'package:elemental/elemental.dart';

ZIO<NoEnv, Never, String> greeting(String name) => ZIO(() => "Hello $name!")

// Note `ZIO<NoEnv, Never, String>` can be shortened to `IO<String>`.

// Here we create a simple wrapper around `print`
IO<Unit> log(String message) => IO(() => print(message)).asUnit;

// And compose them together!
greeting.tap(log).run();

It is worth noting that the above will run synchronously. Only when you start using Future's in your program, will things run asynchronously.

Layers #

A quick intro to services and layers can be found in example/.

5
likes
130
pub points
17%
popularity

Publisher

verified publishertimsmart.co

A toolkit for writing software in dart. Effect-system, dependency management and more!

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

fast_immutable_collections, fpdart, meta, nucleus

More

Packages that depend on elemental