Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fp-ts-quickcheck

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fp-ts-quickcheck - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

22

dist/cjs/arbitrary.d.ts
import { Applicative1 } from "fp-ts/lib/Applicative";
import { Apply1 } from "fp-ts/lib/Apply";
import { Chain1 } from "fp-ts/lib/Chain";
import { Lazy } from "fp-ts/lib/function";
import { Functor1 } from "fp-ts/lib/Functor";

@@ -21,3 +23,3 @@ import { Pointed1 } from "fp-ts/lib/Pointed";

export interface Arbitrary<A> {
arbitrary: gen.Gen<A>;
readonly arbitrary: gen.Gen<A>;
}

@@ -62,2 +64,6 @@ declare module "fp-ts/HKT" {

/**
* @category Typeclasses
*/
export declare const Chain: Chain1<URI>;
/**
* @summary

@@ -70,2 +76,6 @@ * Lift a generator into the `Arbitrary` typeclass.

/**
* @category Constructors
*/
export declare function lazy<A>(lazy: Lazy<Arbitrary<A>>): Arbitrary<A>;
/**
* Arbitrary cannot have a Compactable typeclass instance, as the state needs

@@ -88,3 +98,3 @@ * to be supplied and called before being able to seperate the output

* Generates an array with a fixed size, then each has the random contents.s
* @summary Combinators
* @category Combinators
*/

@@ -107,3 +117,3 @@ export declare function vector(size: number): <A>(fa: Arbitrary<A>) => Arbitrary<readonly A[]>;

*/
export declare function tuple<R extends readonly [Arbitrary<unknown>, ...Arbitrary<unknown>[]]>(...arbitraries: R): Arbitrary<[...{ [K in keyof R]: [R[K]] extends [Arbitrary<infer A>] ? A : never; }]>;
export declare function tuple<R extends readonly [Arbitrary<unknown>, ...(readonly Arbitrary<unknown>[])]>(...arbitraries: R): Arbitrary<[...{ [K in keyof R]: [R[K]] extends [Arbitrary<infer A>] ? A : never; }]>;
/**

@@ -113,3 +123,3 @@ * @category Combinators

export declare function struct<R extends Record<string, unknown>>(struct: EnforceNonEmptyRecord<{
[P in keyof R]: Arbitrary<R[P]>;
readonly [P in keyof R]: Arbitrary<R[P]>;
}>): Arbitrary<R>;

@@ -119,4 +129,4 @@ /**

*/
export declare function union<T extends readonly [unknown, ...unknown[]]>(...arbitraries: {
[P in keyof T]: Arbitrary<T[P]>;
export declare function union<T extends readonly [unknown, ...(readonly unknown[])]>(...arbitraries: {
readonly [P in keyof T]: Arbitrary<T[P]>;
}): Arbitrary<T[number]>;

@@ -123,0 +133,0 @@ /**

@@ -39,5 +39,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.boolean = exports.string = exports.character = exports.int = exports.number = exports.union = exports.struct = exports.tuple = exports.mutable = exports.readonly = exports.vector = exports.array = exports.filter = exports.fromGen = exports.Applicative = exports.Apply = exports.Functor = exports.Pointed = exports.chain = exports.ap = exports.map = exports.of = exports.URI = void 0;
exports.boolean = exports.string = exports.character = exports.int = exports.number = exports.union = exports.struct = exports.tuple = exports.mutable = exports.readonly = exports.vector = exports.array = exports.filter = exports.lazy = exports.fromGen = exports.Chain = exports.Applicative = exports.Apply = exports.Functor = exports.Pointed = exports.chain = exports.ap = exports.map = exports.of = exports.URI = void 0;
/**
* @summary
* The `Arbitrary` typeclass represents a value that can be generated and shrunk.

@@ -100,2 +99,6 @@ *

exports.Applicative = __assign(__assign({}, exports.Pointed), exports.Apply);
/**
* @category Typeclasses
*/
exports.Chain = __assign(__assign({}, exports.Applicative), { chain: function (fa, f) { return (0, exports.chain)(f)(fa); } });
// CONSTRUCTORS

@@ -112,2 +115,10 @@ /**

exports.fromGen = fromGen;
// COMBINATORS
/**
* @category Constructors
*/
function lazy(lazy) {
return { arbitrary: function (s) { return lazy().arbitrary(s); } };
}
exports.lazy = lazy;
function filter(predicate) {

@@ -135,3 +146,3 @@ return function (fa) { return ({

* Generates an array with a fixed size, then each has the random contents.s
* @summary Combinators
* @category Combinators
*/

@@ -138,0 +149,0 @@ function vector(size) {

@@ -23,3 +23,3 @@ /**

export interface Coarbitrary<A> {
coarbitrary: (a: A) => <R>(fa: gen.Gen<R>) => gen.Gen<R>;
readonly coarbitrary: (a: A) => <R>(fa: gen.Gen<R>) => gen.Gen<R>;
}

@@ -26,0 +26,0 @@ declare module "fp-ts/HKT" {

import { monoid as M, option as O, state as S } from "fp-ts";
import * as lcg from "./modules/lcg";
export interface LoopState {
seed: lcg.Seed;
index: number;
successes: number;
failure: O.Option<LoopFailure>;
readonly seed: lcg.Seed;
readonly index: number;
readonly successes: number;
readonly failure: O.Option<LoopFailure>;
}
export interface LoopFailure {
seed: lcg.Seed;
index: number;
data: unknown;
readonly seed: lcg.Seed;
readonly index: number;
readonly data: unknown;
}

@@ -14,0 +14,0 @@ export declare const MonoidFailure: M.Monoid<LoopFailure>;

@@ -10,4 +10,3 @@ import { stateT as ST, task as T } from "fp-ts";

export declare type URI = typeof URI;
export interface StateTask<S, A> extends ST.StateT1<T.URI, S, A> {
}
export declare type StateTask<S, A> = ST.StateT1<T.URI, S, A>;
declare module "fp-ts/HKT" {

@@ -14,0 +13,0 @@ interface URItoKind2<E, A> {

@@ -0,7 +1,16 @@

/**
* @summary
* Quickcheck is a combinator library which can be used to compose generators
* for property based tests.
* The `*assert*` functions run these generators as tests, safely lifting the
* property (not a key in an object, but a property in the context of property
* base testing) result from it's value `HKT<F, A>` to an `FromIO` instance.
*/
import { io as IO } from "fp-ts";
import { task as T } from "../modules/fp-ts";
export interface QuickCheckOptions {
initialSeed: number;
count: number;
size: number;
readonly initialSeed: number;
readonly count: number;
readonly size: number;
}

@@ -8,0 +17,0 @@ export declare type InitialQuickCheckOptions = Partial<QuickCheckOptions>;

@@ -15,2 +15,11 @@ "use strict";

exports.unsafeAssertAsync = exports.assertTask = exports.unsafeAssertSync = exports.assertIO = exports.defaults = void 0;
/**
* @summary
* Quickcheck is a combinator library which can be used to compose generators
* for property based tests.
* The `*assert*` functions run these generators as tests, safely lifting the
* property (not a key in an object, but a property in the context of property
* base testing) result from it's value `HKT<F, A>` to an `FromIO` instance.
*/
var fp_ts_1 = require("fp-ts");

@@ -17,0 +26,0 @@ var function_1 = require("fp-ts/lib/function");

@@ -7,8 +7,8 @@ import { URIS } from "fp-ts/HKT";

export interface LoopOptions<F, I, A> extends TestOptions<F, I, A> {
size: number;
readonly size: number;
}
export interface LoopOptions1<F extends URIS, I, A> extends TestOptions1<F, I, A> {
size: number;
readonly size: number;
}
export declare function loop<F extends URIS>(Monad: Monad1<F>): <I, A>(options: LoopOptions1<F, I, A>) => ST.StateT1<F, ls.LoopState, void>;
export declare function loop<F>(Monad: Monad<F>): <I, A>(options: LoopOptions<F, I, A>) => ST.StateT<F, ls.LoopState, void>;

@@ -13,12 +13,12 @@ import { HKT, Kind, URIS } from "fp-ts/HKT";

export interface AssertDeps<F, A> {
MonadRecIO: MonadRecIO<F>;
Testable: Testable<F, A>;
defaults: QuickCheckOptions;
readonly MonadRecIO: MonadRecIO<F>;
readonly Testable: Testable<F, A>;
readonly defaults: QuickCheckOptions;
}
export interface MakeAssertDeps1<F extends URIS, A> {
MonadRecIO: MonadRecIO1<F>;
Testable: Testable1<F, A>;
defaults: QuickCheckOptions;
readonly MonadRecIO: MonadRecIO1<F>;
readonly Testable: Testable1<F, A>;
readonly defaults: QuickCheckOptions;
}
export declare function makeAssert<F extends URIS, A>(depenencies: MakeAssertDeps1<F, A>): <I>(arbitrary: Arbitrary<I>, property: (value: I) => A, options?: InitialQuickCheckOptions) => Kind<F, void>;
export declare function makeAssert<F, A>(dependencies: AssertDeps<F, A>): <I>(arbitrary: Arbitrary<I>, property: (value: I) => A, options?: InitialQuickCheckOptions) => HKT<F, void>;

@@ -7,10 +7,10 @@ import { Gen } from "@no-day/fp-ts-generators";

export interface TestOptions<F, I, A> {
Arbitrary: Arbitrary<I>;
Testable: Testable<F, A>;
property: (value: I) => A;
readonly Arbitrary: Arbitrary<I>;
readonly Testable: Testable<F, A>;
readonly property: (value: I) => A;
}
export interface TestOptions1<F extends URIS, I, A> {
Arbitrary: Arbitrary<I>;
Testable: Testable1<F, A>;
property: (value: I) => A;
readonly Arbitrary: Arbitrary<I>;
readonly Testable: Testable1<F, A>;
readonly property: (value: I) => A;
}

@@ -17,0 +17,0 @@ export interface TestResults<F> {

import { Applicative1 } from "fp-ts/lib/Applicative";
import { Apply1 } from "fp-ts/lib/Apply";
import { Chain1 } from "fp-ts/lib/Chain";
import { Lazy } from "fp-ts/lib/function";
import { Functor1 } from "fp-ts/lib/Functor";

@@ -21,3 +23,3 @@ import { Pointed1 } from "fp-ts/lib/Pointed";

export interface Arbitrary<A> {
arbitrary: gen.Gen<A>;
readonly arbitrary: gen.Gen<A>;
}

@@ -62,2 +64,6 @@ declare module "fp-ts/HKT" {

/**
* @category Typeclasses
*/
export declare const Chain: Chain1<URI>;
/**
* @summary

@@ -70,2 +76,6 @@ * Lift a generator into the `Arbitrary` typeclass.

/**
* @category Constructors
*/
export declare function lazy<A>(lazy: Lazy<Arbitrary<A>>): Arbitrary<A>;
/**
* Arbitrary cannot have a Compactable typeclass instance, as the state needs

@@ -88,3 +98,3 @@ * to be supplied and called before being able to seperate the output

* Generates an array with a fixed size, then each has the random contents.s
* @summary Combinators
* @category Combinators
*/

@@ -107,3 +117,3 @@ export declare function vector(size: number): <A>(fa: Arbitrary<A>) => Arbitrary<readonly A[]>;

*/
export declare function tuple<R extends readonly [Arbitrary<unknown>, ...Arbitrary<unknown>[]]>(...arbitraries: R): Arbitrary<[...{ [K in keyof R]: [R[K]] extends [Arbitrary<infer A>] ? A : never; }]>;
export declare function tuple<R extends readonly [Arbitrary<unknown>, ...(readonly Arbitrary<unknown>[])]>(...arbitraries: R): Arbitrary<[...{ [K in keyof R]: [R[K]] extends [Arbitrary<infer A>] ? A : never; }]>;
/**

@@ -113,3 +123,3 @@ * @category Combinators

export declare function struct<R extends Record<string, unknown>>(struct: EnforceNonEmptyRecord<{
[P in keyof R]: Arbitrary<R[P]>;
readonly [P in keyof R]: Arbitrary<R[P]>;
}>): Arbitrary<R>;

@@ -119,4 +129,4 @@ /**

*/
export declare function union<T extends readonly [unknown, ...unknown[]]>(...arbitraries: {
[P in keyof T]: Arbitrary<T[P]>;
export declare function union<T extends readonly [unknown, ...(readonly unknown[])]>(...arbitraries: {
readonly [P in keyof T]: Arbitrary<T[P]>;
}): Arbitrary<T[number]>;

@@ -123,0 +133,0 @@ /**

/**
* @summary
* The `Arbitrary` typeclass represents a value that can be generated and shrunk.

@@ -56,2 +55,6 @@ *

export const Applicative = Object.assign(Object.assign({}, Pointed), Apply);
/**
* @category Typeclasses
*/
export const Chain = Object.assign(Object.assign({}, Applicative), { chain: (fa, f) => chain(f)(fa) });
// CONSTRUCTORS

@@ -67,2 +70,9 @@ /**

}
// COMBINATORS
/**
* @category Constructors
*/
export function lazy(lazy) {
return { arbitrary: (s) => lazy().arbitrary(s) };
}
export function filter(predicate) {

@@ -86,3 +96,3 @@ return (fa) => ({

* Generates an array with a fixed size, then each has the random contents.s
* @summary Combinators
* @category Combinators
*/

@@ -89,0 +99,0 @@ export function vector(size) {

@@ -23,3 +23,3 @@ /**

export interface Coarbitrary<A> {
coarbitrary: (a: A) => <R>(fa: gen.Gen<R>) => gen.Gen<R>;
readonly coarbitrary: (a: A) => <R>(fa: gen.Gen<R>) => gen.Gen<R>;
}

@@ -26,0 +26,0 @@ declare module "fp-ts/HKT" {

import { monoid as M, option as O, state as S } from "fp-ts";
import * as lcg from "./modules/lcg";
export interface LoopState {
seed: lcg.Seed;
index: number;
successes: number;
failure: O.Option<LoopFailure>;
readonly seed: lcg.Seed;
readonly index: number;
readonly successes: number;
readonly failure: O.Option<LoopFailure>;
}
export interface LoopFailure {
seed: lcg.Seed;
index: number;
data: unknown;
readonly seed: lcg.Seed;
readonly index: number;
readonly data: unknown;
}

@@ -14,0 +14,0 @@ export declare const MonoidFailure: M.Monoid<LoopFailure>;

@@ -10,4 +10,3 @@ import { stateT as ST, task as T } from "fp-ts";

export declare type URI = typeof URI;
export interface StateTask<S, A> extends ST.StateT1<T.URI, S, A> {
}
export declare type StateTask<S, A> = ST.StateT1<T.URI, S, A>;
declare module "fp-ts/HKT" {

@@ -14,0 +13,0 @@ interface URItoKind2<E, A> {

@@ -0,7 +1,16 @@

/**
* @summary
* Quickcheck is a combinator library which can be used to compose generators
* for property based tests.
* The `*assert*` functions run these generators as tests, safely lifting the
* property (not a key in an object, but a property in the context of property
* base testing) result from it's value `HKT<F, A>` to an `FromIO` instance.
*/
import { io as IO } from "fp-ts";
import { task as T } from "../modules/fp-ts";
export interface QuickCheckOptions {
initialSeed: number;
count: number;
size: number;
readonly initialSeed: number;
readonly count: number;
readonly size: number;
}

@@ -8,0 +17,0 @@ export declare type InitialQuickCheckOptions = Partial<QuickCheckOptions>;

@@ -0,1 +1,10 @@

/**
* @summary
* Quickcheck is a combinator library which can be used to compose generators
* for property based tests.
* The `*assert*` functions run these generators as tests, safely lifting the
* property (not a key in an object, but a property in the context of property
* base testing) result from it's value `HKT<F, A>` to an `FromIO` instance.
*/
import { io as IO } from "fp-ts";

@@ -2,0 +11,0 @@ import { flow } from "fp-ts/lib/function";

@@ -7,8 +7,8 @@ import { URIS } from "fp-ts/HKT";

export interface LoopOptions<F, I, A> extends TestOptions<F, I, A> {
size: number;
readonly size: number;
}
export interface LoopOptions1<F extends URIS, I, A> extends TestOptions1<F, I, A> {
size: number;
readonly size: number;
}
export declare function loop<F extends URIS>(Monad: Monad1<F>): <I, A>(options: LoopOptions1<F, I, A>) => ST.StateT1<F, ls.LoopState, void>;
export declare function loop<F>(Monad: Monad<F>): <I, A>(options: LoopOptions<F, I, A>) => ST.StateT<F, ls.LoopState, void>;

@@ -13,12 +13,12 @@ import { HKT, Kind, URIS } from "fp-ts/HKT";

export interface AssertDeps<F, A> {
MonadRecIO: MonadRecIO<F>;
Testable: Testable<F, A>;
defaults: QuickCheckOptions;
readonly MonadRecIO: MonadRecIO<F>;
readonly Testable: Testable<F, A>;
readonly defaults: QuickCheckOptions;
}
export interface MakeAssertDeps1<F extends URIS, A> {
MonadRecIO: MonadRecIO1<F>;
Testable: Testable1<F, A>;
defaults: QuickCheckOptions;
readonly MonadRecIO: MonadRecIO1<F>;
readonly Testable: Testable1<F, A>;
readonly defaults: QuickCheckOptions;
}
export declare function makeAssert<F extends URIS, A>(depenencies: MakeAssertDeps1<F, A>): <I>(arbitrary: Arbitrary<I>, property: (value: I) => A, options?: InitialQuickCheckOptions) => Kind<F, void>;
export declare function makeAssert<F, A>(dependencies: AssertDeps<F, A>): <I>(arbitrary: Arbitrary<I>, property: (value: I) => A, options?: InitialQuickCheckOptions) => HKT<F, void>;

@@ -7,10 +7,10 @@ import { Gen } from "@no-day/fp-ts-generators";

export interface TestOptions<F, I, A> {
Arbitrary: Arbitrary<I>;
Testable: Testable<F, A>;
property: (value: I) => A;
readonly Arbitrary: Arbitrary<I>;
readonly Testable: Testable<F, A>;
readonly property: (value: I) => A;
}
export interface TestOptions1<F extends URIS, I, A> {
Arbitrary: Arbitrary<I>;
Testable: Testable1<F, A>;
property: (value: I) => A;
readonly Arbitrary: Arbitrary<I>;
readonly Testable: Testable1<F, A>;
readonly property: (value: I) => A;
}

@@ -17,0 +17,0 @@ export interface TestResults<F> {

@@ -7,3 +7,3 @@ {

"homepage": "https://github.com/fp-ts-quickcheck",
"version": "0.3.1",
"version": "0.3.2",
"files": [

@@ -15,10 +15,18 @@ "dist"

"@types/node": "^16.10.1",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"docs-ts": "^0.6.10",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-functional": "^4.2.0",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-prettier": "^4.0.0",
"fast-check": "^2.17.0",
"jest": "^27.2.2",
"prettier": "^2.4.1",
"prettier": "^2.5.1",
"standard-version": "^9.3.2",
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"typescript": "^4.4.3"
"tsutils": "^3.21.0",
"typescript": "^4.5.5"
},

@@ -25,0 +33,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc