giogonzo / fp-ts-laws

fp-ts type class laws for property based testing

Home Page:https://gcanti.github.io/fp-ts-laws/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fp-ts type class laws for property based testing

Usage of fast-check is required.

Example

import * as laws from 'fp-ts-laws'
import * as fc from 'fast-check'

import { Semigroup } from 'fp-ts/lib/Semigroup'
import { setoidString } from 'fp-ts/lib/Setoid'

describe('my semigroup instance', () => {
  it('should test Semigroup laws', () => {
    const semigroupSpace: Semigroup<string> = {
      concat: (x, y) => x + ' ' + y
    }
    laws.semigroup(semigroupSpace, setoidString, fc.string())
  })
})

For other examples check out the tests

About

fp-ts type class laws for property based testing

https://gcanti.github.io/fp-ts-laws/

License:MIT License


Languages

Language:TypeScript 99.2%Language:JavaScript 0.8%