Tuesday, June 15, 2010

Simplified case class Generator for Scalacheck

I just wrote a fairly handy generator for making very simple vanilla case classes. It basically uses the apply method defined in the companion of them to make things pretty simple. I am not sure if something similar is in the library already.


basically you can just type in your specification.

implicit val arbPoint = ArbFunc(Point.apply _)

and then arbitrary points will be provided as needed

If I posted the code here i have feeling it would get severely mangled so I put it in a gist:

http://gist.github.com/440002

I think it is a simpler way to make the generators for case classes where you don't care that much about constraining the members of the case class.

posted to the mailing list, waiting for moderation.

No comments: