Home

Awesome

purescript-strongcheck-generics

purescript-strongcheck-generics on Pursuit Latest release Build Status

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 for details.

Installation

bower install purescript-strongcheck-generics

Example

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

Documentation