Giter Club home page Giter Club logo

elemental's Introduction

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/.

elemental's People

Contributors

tim-smart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sandromaglione

elemental's Issues

`fpdart` / `ZIO` integration?

Hi @tim-smart

Sandro here (fpdart's author) ๐Ÿ‘‹

I took a look at you ZIO implementation and it looks really promising. I think there is some overlap with fpdart's API (on effects, IO, Task, TaskEither, etc.).

This situation looks similar to fp-ts + effect-ts: fp-ts originally providing IO, Task, TaskEither (just like fpdart), while effect-ts with Effect (ZIO).

I think it could be interesting considering a consolidation of both our implementations (fpdart + ZIO). I really like the ZIO approach:

  • One class for all effects (ZIO instead of IO, Task, etc.). This makes easier (possibly) to explain one concept ZIO instead of many different classes
  • Easier to maintain (one implementation instead of many similar method in different effects)
  • Aligned with effect-ts and ZIO (Scala), possibly sharing some documentation and resources

What I would suggest is a possible integration of ZIO inside fpdart (for a possible v1.0 release?).

@tim-smart what do you think about this? Am I correct about the similarities between ZIO and fpdart's effects? Is there something that the ZIO implementation is missing compared to fpdart's effects?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.