SmartCheck icon indicating copy to clipboard operation
SmartCheck copied to clipboard

Support custom QuickCheck generators

Open gridaphobe opened this issue 10 years ago • 1 comments

It would be nice if SmartCheck supported custom generators, like QuickCheck does with forAll. For example, I want to use SmartCheck to test an interpreter I'm working on, but I need to be able generate expressions of a given type. I can probably work around it with the standard newtype trick though, for now.

gridaphobe avatar Jun 27 '15 00:06 gridaphobe

I am looking into this for the same reason. but does this work? if you have:

data Ast = Application Ast Ast | ...
newtype Typed = Typed Ast

it seems to me that the reduce/smartshrink will try breathfirst to replace subtrees with smaller versions based on arbitrary instance of that node. So if search for replacement in (Typed (App replacement term)). it pick arbitrary instance from (arbitrary Ast) for replacement. which might not be typed. Am i wrong? Does this still work? and if it does not is it still useful?

hope you can tell me :)

kwibus avatar Aug 07 '17 22:08 kwibus