diff options
Diffstat (limited to 'src/GF/Shell.hs')
| -rw-r--r-- | src/GF/Shell.hs | 12 |
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 |
