Last updated:
0 purchases
functionally
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.
A more object-oriented way which uses builders to chain methods and build the functional types.
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);
}
copied to clipboard
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);
}
copied to clipboard
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.