All Projects → funfix → Funfix

funfix / Funfix

Licence: apache-2.0
Functional Programming Library for JavaScript, TypeScript and Flow ✨⚡️

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
es2015
71 projects
flowtype
47 projects

Projects that are alternatives of or similar to Funfix

Fun Task
Abstraction for managing asynchronous code in JS
Stars: ✭ 363 (-39.09%)
Mutual labels:  async, functional-programming, fp
Prelude Ts
Functional programming, immutable collections and FP constructs for typescript and javascript
Stars: ✭ 315 (-47.15%)
Mutual labels:  futures, functional-programming, fp
Zio Saga
Purely Functional Transaction Management In Scala With ZIO
Stars: ✭ 200 (-66.44%)
Mutual labels:  concurrency, functional-programming, fp
Fasy
FP iterators that are both eager and asynchronous
Stars: ✭ 488 (-18.12%)
Mutual labels:  async, functional-programming, fp
Smol
A small and fast async runtime for Rust
Stars: ✭ 2,206 (+270.13%)
Mutual labels:  async, concurrency, futures
Shapeless
Generic programming for Scala
Stars: ✭ 3,207 (+438.09%)
Mutual labels:  functional-programming, fp
Monio
Async-capable IO monad for JS
Stars: ✭ 311 (-47.82%)
Mutual labels:  functional-programming, fp
Vertx Zero
Zero Framework:http://www.vertxup.cn
Stars: ✭ 320 (-46.31%)
Mutual labels:  async, functional-programming
Promise Fun
Promise packages, patterns, chat, and tutorials
Stars: ✭ 3,779 (+534.06%)
Mutual labels:  async, concurrency
Pfps Shopping Cart
🛒 The Shopping Cart application developed in the book "Practical FP in Scala: A hands-on approach"
Stars: ✭ 262 (-56.04%)
Mutual labels:  functional-programming, fp
Swoole Src
🚀 Coroutine-based concurrency library for PHP
Stars: ✭ 17,175 (+2781.71%)
Mutual labels:  async, concurrency
Kotlin Result
A multiplatform Result monad for modelling success or failure operations.
Stars: ✭ 369 (-38.09%)
Mutual labels:  functional-programming, fp
Eslint Plugin Functional
ESLint rules to disable mutation and promote fp in JavaScript and TypeScript.
Stars: ✭ 282 (-52.68%)
Mutual labels:  functional-programming, fp
Golang Tutorials
Go Tutorials - Let's get our hands really dirty by writing a lot of Golang code
Stars: ✭ 277 (-53.52%)
Mutual labels:  concurrency, functional-programming
Python3 Concurrency Pics 02
爬取 www.mzitu.com 全站图片,截至目前共5162个图集,16.5万多张美女图片,使用 asyncio 和 aiohttp 实现的异步版本只需要不到2小时就能爬取完成。按日期创建图集目录,保存更合理。控制台只显示下载的进度条,详细信息保存在日志文件中。支持异常处理,不会终止爬虫程序。失败的请求,下次再执行爬虫程序时会自动下载
Stars: ✭ 275 (-53.86%)
Mutual labels:  concurrency, futures
Thread Pool
Thread pool implementation using c++11 threads
Stars: ✭ 417 (-30.03%)
Mutual labels:  concurrency, futures
Asks
Async requests-like httplib for python.
Stars: ✭ 429 (-28.02%)
Mutual labels:  async, concurrency
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (-9.73%)
Mutual labels:  functional-programming, fp
Promise Pool
Map-like, concurrent promise processing
Stars: ✭ 258 (-56.71%)
Mutual labels:  async, concurrency
Drone Core
The core crate for Drone, an Embedded Operating System.
Stars: ✭ 263 (-55.87%)
Mutual labels:  async, concurrency

Funfix

Travis Coverage Status Greenkeeper badge npm Join chat

Funfix is a library of type classes and data types for Functional Programming in JavaScript, TypeScript and Flow.

Inspired by Scala, Cats and Monix.

Usage

The code is organized in sub-projects, for à la carte dependencies, but all types, classes and functions are exported by funfix, so to import everything:

npm install --save funfix

Or you can depend on individual sub-projects, see below.

Modules: UMD and ES 2015

The library has been compiled using UMD (Universal Module Definition), so it should work with CommonJS and AMD, for standalone usage in browsers or Node.js.

But it also provides a module definition in package.json, thus providing compatibility with ECMAScript 2015 modules, for usage when used with a modern JS engine, or when bundling with a tool chain that understands ES2015 modules, like Rollup or Webpack.

Sub-projects

Funfix has been split in multiple sub-projects for à la carte dependency management. As mentioned above, you can depend on everything by depending on the funfix project.

These sub-projects are:

funfix-core

npm

Exposes primitive interfaces and data types that need to be universally available, belonging into a standard library.

See JSDoc documentation.

Quick Overview & Usage
npm install --save funfix-core

Exposes types for expressing disjunctions:

Either data type for expressing results with two possible outcome types (a disjoint union)
Option data type for expressing optional values
Try data type for representing the result of computations that may result in either success or failure

Standard interfaces and tools for dealing with universal equality and hash code generation:

IEquals an interface for defining universal equality and hash code
is and equals for using IEquals in tests, or otherwise falls back to JavaScript's equality (== or valueOf())
hashCode for calculating hash codes (for usage in sets and maps data structures) using IEquals, or otherwise falls back to calculating a hash from .valueOf() or from .toString()
isValueObject for testing if a given object implements IEquals

Standard, reusable error types, that help with some common scenarios, working with error types being preferable to working with strings:

DummyError for tagging errors used for testing purposes
IllegalArgumentError for signaling that a given argument is violating the contract of the called function or constructor
IllegalInheritanceError for signaling that inheriting from a certain class is illegal
IllegalStateError for signaling that an illegal code branch was executed and thus something is wrong with the code and needs investigation (e.g. a bug)
NoSuchElementError thrown when the user expects an element to be returned from a function call, but no such element exists
NotImplementedError thrown in case an implementation is missing
TimeoutError thrown in case the execution of a procedure takes longer than expected
CompositeError for gathering multiple errors in a single reference that can expose them as a list

Misc utilities:

applyMixins for working with mixins (i.e. classes used as interfaces, with methods that have default implementations), see Mixins for an explanation
id is the "identity" function

funfix-exec

npm

Contains low level / side-effectful utilities and data types for building higher level concurrency tools.

See JSDoc documentation.

Quick Overview & Usage
npm install --save funfix-exec

Scheduling tasks for asynchronous execution:

Future a lawful, fast, cancelable alternative to JavaScript's Promise
Scheduler the alternative to using setTimeout for asynchronous boundaries or delayed execution

In support of futures and schedulers, ICancelable data types are introduced for dealing with cancellation concerns:

ICancelable and Cancelable for expressing actions that can be triggered to cancel processes / dispose of resources
IBoolCancelable and BoolCancelable for cancelable references that can be queried for their isCanceled status
IAssignCancelable and AssignCancelable for cancelable references that can be assigned (behave like a box for) another reference
MultiAssignCancelable being a mutable cancelable whose underlying reference can be updated multiple times
SingleAssignCancelable for building forward references, much like MultiAssignCancelable except that it can be assigned only once, triggering an error on the second attempt
SerialCancelable being like a MultiAssignCancelable that cancels its previous underlying reference on updates

And also types for expressing durations:

TimeUnit inspired by Java's own enumeration, representing time
Duration inspired by Scala's own type, as a type safe representation for durations

funfix-effect

npm

Defines monadic data types for controlling laziness, asynchrony and side effects. Exposes the most advanced IO implementation for JavaScript.

See JSDoc documentation.

Quick Overview & Usage
npm install --save funfix-effect

The exposed data types:

Eval lawful, lazy, monadic data type, that can control evaluation, inspired by the Eval type in Typelevel Cats and by the Coeval type in Monix, a more simple IO-like type that can only handle immediate execution, no async boundaries, no error handling, not being meant for suspending side effects.
IO lawful, lazy, monadic data type, capable of expressing and composing side effectful actions, including asynchronous, being the most potent and capable alternative to JavaScript's Promise, inspired by Haskell's IO and by the Monix Task

TypeScript or Flow?

Funfix supports both TypeScript and Flow type annotations out of the box.

It also makes the best use of the capabilities of each. For example TypeScript has bivariant generics, but Flow supports variance annotations and Funfix makes use of them. Development happens in TypeScript, due to better tooling, but both are first class citizens.

Contributing

The Funfix project welcomes contributions from anybody wishing to participate. All code or documentation that is provided must be licensed with the same license that Funfix is licensed with (Apache 2.0).

Feel free to open an issue if you notice a bug, have an idea for a feature, or have a question about the code. Pull requests are also gladly accepted. For more information, check out the contributor guide.

License

All code in this repository is licensed under the Apache License, Version 2.0. See LICENCE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].