All Projects → funfix → Funland

funfix / Funland

Licence: mit
Type classes for interoperability of common algebraic structures in JavaScript, TypeScript and Flow

Programming Languages

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

Projects that are alternatives of or similar to Funland

Monio
Async-capable IO monad for JS
Stars: ✭ 311 (+576.09%)
Mutual labels:  functional-programming, fp
Fp Jargon Zh
函数式编程术语及示例。本项目译自 https://github.com/hemanth/functional-programming-jargon
Stars: ✭ 507 (+1002.17%)
Mutual labels:  functional-programming, fp
Fun Task
Abstraction for managing asynchronous code in JS
Stars: ✭ 363 (+689.13%)
Mutual labels:  functional-programming, fp
Stm4cats
STM monad for cats-effect
Stars: ✭ 35 (-23.91%)
Mutual labels:  functional-programming, fp
Frameless
Expressive types for Spark.
Stars: ✭ 717 (+1458.7%)
Mutual labels:  functional-programming, fp
Shapeless
Generic programming for Scala
Stars: ✭ 3,207 (+6871.74%)
Mutual labels:  functional-programming, fp
Fasy
FP iterators that are both eager and asynchronous
Stars: ✭ 488 (+960.87%)
Mutual labels:  functional-programming, fp
Functional Programming Jargon
Jargon from the functional programming world in simple terms!
Stars: ✭ 14,351 (+31097.83%)
Mutual labels:  functional-programming, fp
Funfix
Functional Programming Library for JavaScript, TypeScript and Flow ✨⚡️
Stars: ✭ 596 (+1195.65%)
Mutual labels:  functional-programming, fp
Fkit
A functional programming toolkit for JavaScript.
Stars: ✭ 588 (+1178.26%)
Mutual labels:  functional-programming, fp
Eslint Plugin Functional
ESLint rules to disable mutation and promote fp in JavaScript and TypeScript.
Stars: ✭ 282 (+513.04%)
Mutual labels:  functional-programming, fp
Bugz
🐛 Composable User Agent Detection using Ramda
Stars: ✭ 15 (-67.39%)
Mutual labels:  functional-programming, fp
Pfps Shopping Cart
🛒 The Shopping Cart application developed in the book "Practical FP in Scala: A hands-on approach"
Stars: ✭ 262 (+469.57%)
Mutual labels:  functional-programming, fp
Prelude Ts
Functional programming, immutable collections and FP constructs for typescript and javascript
Stars: ✭ 315 (+584.78%)
Mutual labels:  functional-programming, fp
Pratica
🥃 Functional Algebraic Data Types
Stars: ✭ 246 (+434.78%)
Mutual labels:  functional-programming, fp
Kotlin Result
A multiplatform Result monad for modelling success or failure operations.
Stars: ✭ 369 (+702.17%)
Mutual labels:  functional-programming, fp
Bow Arch
🏛 Functional Architecture in Swift using Bow
Stars: ✭ 166 (+260.87%)
Mutual labels:  functional-programming, fp
Zio Saga
Purely Functional Transaction Management In Scala With ZIO
Stars: ✭ 200 (+334.78%)
Mutual labels:  functional-programming, fp
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (+1069.57%)
Mutual labels:  functional-programming, fp
D4s
Dynamo DB Database Done Scala-way
Stars: ✭ 27 (-41.3%)
Mutual labels:  functional-programming, fp

Funland

Travis Coverage Status Greenkeeper badge npm Join chat

Funland is a specification of common algebraic structures for JavaScript, TypeScript and Flow, based on Fantasy Land and compatible with static-land.

Usage

For the TypeScript / Flow types, which are very light (no accompanying JavaScript code, just types):

npm install --save funland

For the laws:

npm install --save funland-laws

Usage of laws mostly makes sense in tests, being built for property-based testing, so usage of jsverify is recommended, but not required.

Documentation

API docs:

Exposed type classes:

Testing the Included Type-class Laws

The included laws are meant for usage with property-based testing, so you'll need something like jsverify as a dependency.

npm install funland-laws --save-dev

npm install jsverify --save-dev

# For jsverify types (for TypeScript):
npm install @types/jsverify --save-dev

And then you can do something like this:

import * as jv from "jsverify"
import { Setoid } from "funland"
import { Equiv, SetoidLaws } from "funland-laws"

export function setoidCheck<A>(
  genA: jv.Arbitrary<A>,
  F: Setoid<A>,
  lawsRef?: SetoidLaws<A>) {

  const laws = lawsRef || new SetoidLaws<A>(F)
  const eq = (p: Equiv<boolean>) => p.lh === p.rh

  jv.property("setoid.reflexivity", genA,
    x => eq(laws.reflexivity(x)))

  jv.property("setoid.symmetry", genA, genA,
    (x, y) => eq(laws.symmetry(x, y)))

  jv.property("setoid.transitivity", genA, genA, genA,
    (x, y, z) => eq(laws.transitivity(x, y, z)))
}

Such integration is currently not provided by Funland, however the project's repository has code to use for inspiration, see github.com/.../funland-laws/test-common.

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.

TypeScript or Flow?

Funland exposes both TypeScript and Flow type annotations out of the box.

Contributing

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

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