1
0
forked from GitHub/gf-core

update PGFService to work after the extensions in the random generation API

This commit is contained in:
krasimir
2010-09-30 07:35:54 +00:00
parent 10a0d370dc
commit 72f505d7df
2 changed files with 6 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ import Data.List (sortBy,intersperse,mapAccumL)
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.Maybe import Data.Maybe
import System.Directory import System.Directory
import System.Random
import System.FilePath import System.FilePath
import System.Process import System.Process
import System.Exit import System.Exit
@@ -466,7 +467,9 @@ linearizeAndBind pgf mto t = [(la, binds s) | (la,s) <- linearize' pgf mto t]
_ -> [] _ -> []
random' :: PGF -> Maybe PGF.Type -> IO [PGF.Tree] random' :: PGF -> Maybe PGF.Type -> IO [PGF.Tree]
random' pgf mcat = PGF.generateRandom pgf (fromMaybe (PGF.startCat pgf) mcat) random' pgf mcat = do
g <- newStdGen
return $ PGF.generateRandom (PGF.RandSel g) pgf (fromMaybe (PGF.startCat pgf) mcat)
selectLanguage :: PGF -> Maybe (Accept Language) -> PGF.Language selectLanguage :: PGF -> Maybe (Accept Language) -> PGF.Language
selectLanguage pgf macc = case acceptable of selectLanguage pgf macc = case acceptable of

View File

@@ -21,7 +21,8 @@ executable pgf-server
json >= 0.3.3, json >= 0.3.3,
utf8-string >= 0.3.1.1, utf8-string >= 0.3.1.1,
bytestring, bytestring,
pretty pretty,
random
if !os(windows) if !os(windows)
build-depends: unix build-depends: unix
main-is: PGFService.hs main-is: PGFService.hs