
On Wed, Apr 04, 2007 at 10:59:45PM +0100, Joel Reymont wrote:
One last bit then...
My identifiers should start with letter <|> char '_' and the tail should be alphaNum <|> char '_'.
I guess I can use choose and oneof to produce the right set of characters but how do I combine the two into a single identifier of a given length (up to 20 chars, say)?
Thanks, Joel
On Apr 4, 2007, at 5:27 PM, Fawzi Mohamed wrote:
Great, just one thing that could be important : when you have recursive structures (like your Statement through Compound) be sure to use sized (\mySize -> ...) as generator for arbitrary so that you can avoid infinite looping.
quickcheck is a monad so you can just do: do first <- elements $ '_' : ['a' .. 'z'] len <- elements $ [5..19] rest <- replicateM len $ elements $ '_' : ['a' .. 'z'] ++ ['0' .. '9'] return (first : rest)