This library introduces numerous pure functional types, much like fp-ts

Features

Here are some examples of types which you may find

  • Either
  • IO
  • Task
  • Reader
  • ReaderStream
  • ...

Keep in mind that I will be adding more types as I continue development. If you need one in particular, just open an issue.

Usage

There are two ways to use this library.

  1. A more object-oriented way which uses builders to chain methods and build the functional types.
  2. A more functional way which sequentially pipes functions to get a result.

Object-oriented:

import 'package:functionally/builders.dart';

void main() {
  final readerStream =
        ReaderStreamBuilder.ask<String>()
          .map((hello) => '$hello World')
          .build();

  readerStream('Hello').listen(print);
}

Functional:

import 'package:functionally/reader_stream.dart' as RS;
import 'package:functionally/common.dart';

void main() {
  final readerStream = pipe2(
    RS.ask<String>(),
    RS.map((hello) => '$hello World'),
  );

  readerStream('Hello').listen(print);
}

Examples

You may also find more examples in Fridgy, an app written with this library.

Anyway, these samples will probably not help you much if you don't have experience with pure functional paradigms. If you have experience with typescript and want to learn more, i suggest searching online guides about fp-ts. Otherwise consider learning Haskell or Scala :P.

Libraries

builders
common
either
io
option
reader
Support for doing something awesome.
reader_io
Support for doing something awesome.
reader_stream
Support for doing something awesome.
reader_task
Support for doing something awesome.
stream
stream_either
Support for doing something awesome.
stream_option
task
task_either
task_option