All Projects → briancavalier → Fx Ts

briancavalier / Fx Ts

Computational environments and effects for TypeScript

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Fx Ts

Functionaljava
Functional programming in Java
Stars: ✭ 1,472 (+3404.76%)
Mutual labels:  functional-programming, effects
Pfun
Functional, composable, asynchronous, type-safe Python.
Stars: ✭ 75 (+78.57%)
Mutual labels:  functional-programming, effects
Parapet
A purely functional library to build distributed and event-driven systems
Stars: ✭ 106 (+152.38%)
Mutual labels:  functional-programming, effects
Algebraic Effects
Manage side-effects in your javascript application cleanly with algebraic effects
Stars: ✭ 162 (+285.71%)
Mutual labels:  functional-programming, effects
Zio
ZIO — A type-safe, composable library for async and concurrent programming in Scala
Stars: ✭ 3,167 (+7440.48%)
Mutual labels:  functional-programming, effects
Effect
effect isolation in Python, to facilitate more purely functional code
Stars: ✭ 324 (+671.43%)
Mutual labels:  functional-programming, effects
Tofu
Functional programming toolbox
Stars: ✭ 281 (+569.05%)
Mutual labels:  functional-programming, effects
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (+1180.95%)
Mutual labels:  functional-programming, effects
Ngrx French Guide
Le guide sur l'utilisation de NGRX dans une application Angular
Stars: ✭ 31 (-26.19%)
Mutual labels:  effects
Stm4cats
STM monad for cats-effect
Stars: ✭ 35 (-16.67%)
Mutual labels:  functional-programming
Purrr
A functional programming toolkit for R
Stars: ✭ 953 (+2169.05%)
Mutual labels:  functional-programming
Oqaml
An OCaml based implementation of a Quil QVM
Stars: ✭ 31 (-26.19%)
Mutual labels:  functional-programming
Imagene
A General Purpose Image Manipulation Tool
Stars: ✭ 36 (-14.29%)
Mutual labels:  functional-programming
Docker Iocaml Datascience
Dockerfile of Jupyter (IPython notebook) and IOCaml (OCaml kernel) with libraries for data science and machine learning
Stars: ✭ 30 (-28.57%)
Mutual labels:  functional-programming
Purefun
Functional Programming library for Java
Stars: ✭ 37 (-11.9%)
Mutual labels:  functional-programming
Immutable Tuple
Immutable finite list objects with constant-time equality testing (===) and no memory leaks.
Stars: ✭ 29 (-30.95%)
Mutual labels:  functional-programming
Enum Fp
Functional Enum type / Sum type for javascript with simple pattern matching
Stars: ✭ 27 (-35.71%)
Mutual labels:  functional-programming
Lambda
λ → C++ library for functional programming
Stars: ✭ 38 (-9.52%)
Mutual labels:  functional-programming
Safedom
🔫 safedom is a safe way to you manipulate dom using a purer functional style.
Stars: ✭ 37 (-11.9%)
Mutual labels:  functional-programming
Shell Functools
Functional programming tools for the shell
Stars: ✭ 971 (+2211.9%)
Mutual labels:  functional-programming

fx-ts

Capabilities & Effects for TypeScript

FeaturesInstallExamplesDocumentation

Features

  • Do-notation for effects: Write imperative-looking code that's fully referentially transparent
  • Asychronous effects with cancelation: Seamlessly mix synchronous and asynchronous effects without worry
  • Effect inference: Effects can be inferred without explicit type annotations
  • Extensible: Implement new effects in user land
  • Testable: Code to interfaces, and easily use different implementations for development, production, and testing
  • Efficient: Synchronous and Asynchronous effects run in constant stack

Install

npm install --save fx-ts

Examples

These examples are intended to be run against master using ts-node. For example:

$ ./node_modules/.bin/ts-node -O '{ "module": "commonjs" }' ./examples/echo-console.ts

This example runs on AWS Lambda. If you have a serverless account and have setup your AWS credentials, you can deploy it using serverless:

$ cd examples/lambda-pets
$ ./node_modules/.bin/serverless deploy

Running the examples

The

Documentation

Pure functions are easy to reason about and test because they aren't entangled with the environment in which they're called. They always give the same answer for the same inputs. Nevertheless, useful programs need to interact with their environment. They need access to databases, external services, or configuration, and need to perform effects like reading and writing files, updating databases, etc.

The goal of fx-ts is to help in writing programs that interact with their environment and are easy to reason about and test.

// Abstract Print & Read capabilities

type Print = { print(s: string): Fx<unknown, void> }

type Read = { read: Fx<Async, string> }

const main = doFx(function* () {
  const { print, read } = yield* get<Print & Read>()
  while (true) {
    yield* print('> ')
    const s = yield* read
    yield* print(`${s}${EOL}`)
  }
})

const capabilities = {
  // ...Concrete implementation of Print and Read...
}

runFx(main(), capabilities)

API

Coming soon

Inspiration

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