Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zudov/purescript-strongcheck-generics

Generics for purescript-strongcheck
https://github.com/zudov/purescript-strongcheck-generics

Last synced: 12 days ago
JSON representation

Generics for purescript-strongcheck

Awesome Lists containing this project

README

        

# purescript-strongcheck-generics

[![purescript-strongcheck-generics on Pursuit](https://pursuit.purescript.org/packages/purescript-strongcheck-generics/badge)](http://pursuit.purescript.org/packages/purescript-strongcheck-generics)
[![Latest release](https://img.shields.io/bower/v/purescript-strongcheck-generics.svg)](https://github.com/zudov/purescript-strongcheck-generics/releases)
[![Build Status](https://travis-ci.org/zudov/purescript-strongcheck-generics.svg?branch=master)](https://travis-ci.org/zudov/purescript-strongcheck-generics)

Generic deriving for `Arbitrary`/`CoArbitrary`, and generation of `GenericSpine`/`GenericSignature`.

**Warning:** It was noticed that generating a spine for deeply recursive data structures (particularly those
that include arrays of themselves) can hang running indefinetely. See [issue 5](https://github.com/zudov/purescript-strongcheck-generics/issues/5) for details.

## Installation

```shell
bower install purescript-strongcheck-generics
```

## Example

```purescript
module Main where

import Prelude

import Data.Generic

import Test.StrongCheck
import Test.StrongCheck.Gen
import Test.StrongCheck.Generic

data Tree a = Leaf | Branch { value :: a, kids :: Array (Tree a) }

derive instance genericTree :: (Generic a) => Generic (Tree a)

instance showTree :: (Show a, Generic a) => Show (Tree a) where
show = gShow

main = do
showSample (gArbitrary :: Gen (Tree Int))
```

[Output](https://travis-ci.org/zudov/purescript-strongcheck-generics/builds/91160401#L733)

## Documentation

- [Test.StrongCheck.Generic](docs/Test/StrongCheck/Generic.md)