2008/3/16 Sebastian Sylvan <[EMAIL PROTECTED]>: > featureGenNormal = do > id <- stringGen > name <- stringGen > featuretype <- arbitrary > grouptype <- arbitrary > children <- arbitrary > properties <- listGen stringGen > return (Feature id name featuretype grouptype children properties) > > > Note that we use "arbitrary" to generate the list of children recursively.
Also, you can shorten this significantly with liftM or ap (from Control.Monad): > featureGenNormal = liftM6 Feature stringGen stringGen arbitrary arbitrary > arbitrary (listGen stringGen) > featureGenNormal = return Feature `ap` stringGen `ap` stringGen `ap` > arbitrary `ap` arbitrary `ap` listGen stringGen _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
