From d4ee4a6133c2ce54460fc031576d7ef905c7261e Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 17 Oct 2011 13:51:25 +0000 Subject: example-based: use random generation for the examples --- src/example-based/ExampleService.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/example-based/ExampleService.hs') diff --git a/src/example-based/ExampleService.hs b/src/example-based/ExampleService.hs index e4198a87b..ecead5425 100644 --- a/src/example-based/ExampleService.hs +++ b/src/example-based/ExampleService.hs @@ -1,4 +1,5 @@ module ExampleService(cgiMain,cgiMain',newPGFCache) where +import System.Random(newStdGen) import System.FilePath((),makeRelative) import Data.Map(fromList) import Data.Char(isDigit) @@ -33,7 +34,8 @@ doProvideExample root cwd cache environ = parsePGF <- readParsePGF cwd cache let adjpath path = rootmakeRelative "/" (makeRelative root cwdpath) pgf <- liftIO . readCache cache . adjpath =<< getInp "grammar" - let Just (e,s) = E.provideExample environ fun parsePGF pgf lang + gen <- liftIO newStdGen + let Just (e,s) = E.provideExample gen environ fun parsePGF pgf lang res = (showExpr [] e,s) liftIO $ logError $ "proveExample ... = "++show res outputJSONP res -- cgit v1.2.3