summaryrefslogtreecommitdiff
path: root/src/GF/Shell.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-04-30 11:28:35 +0000
committeraarne <unknown>2004-04-30 11:28:35 +0000
commitc9d10ab5ed8b82ba0f74a25ca30103ccf0985e6d (patch)
tree610a280c538abc742941b5d31b7d5912d0f7b0bd /src/GF/Shell.hs
parent36a68bce6ab94a4824698b9c3d7b4d0da4898eea (diff)
random gen to fill given term
Diffstat (limited to 'src/GF/Shell.hs')
-rw-r--r--src/GF/Shell.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 9e922171f..2fdf6dabd 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -173,15 +173,17 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
CTranslate il ol -> do
let a' = opST2CommandArg (optParseArgErr opts (sgr il)) a
returnArg (opTS2CommandArg (optLinearizeTreeVal opts (sgr ol)) a') sa
- CGenerateRandom n -> case a of
- ASTrm _ -> do
- case s2t a of
- ATrms [trm] -> do
+ CGenerateRandom n -> do
+ let
+ a' = case a of
+ ASTrm _ -> s2t a
+ _ -> a
+ case a' of
+ ATrms (trm:_) -> do
g <- newStdGen
case (goFirstMeta (tree2loc trm) >>= refineRandom g 41 cgr) of
Ok trm' -> returnArg (ATrms [loc2tree trm']) sa
Bad s -> returnArg (AError s) sa
- _ -> returnArg a sa
_ -> do
ts <- randomTreesIO opts gro (optIntOrN opts flagNumber n)
returnArg (ATrms ts) sa