leepike / SmartCheck

A Smarter QuickCheck
BSD 3-Clause "New" or "Revised" License
102 stars 2 forks source link

Support custom QuickCheck generators #6

Open gridaphobe opened 9 years ago

gridaphobe commented 9 years ago

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.

kwibus commented 6 years ago

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 :)