diff options
Diffstat (limited to 'src/GF/Canon')
| -rw-r--r-- | src/GF/Canon/Look.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/GF/Canon/Look.hs b/src/GF/Canon/Look.hs index 1ac39c695..2fc652c81 100644 --- a/src/GF/Canon/Look.hs +++ b/src/GF/Canon/Look.hs @@ -125,8 +125,22 @@ allParamValues cnc ptyp = case ptyp of -- runtime computation on GFC objects ccompute :: CanonGrammar -> [Term] -> Term -> Err Term -ccompute cnc = comp [] +ccompute cnc = vcomp where + + vcomp xs t = do + let xss = variations xs + ts <- mapM (\xx -> comp [] xx t) xss + return $ variants ts + + variations xs = combinations [getVariants t | t <- xs] + variants ts = case ts of + [t] -> t + _ -> FV ts + getVariants t = case t of + FV ts -> ts + _ -> [t] + comp g xs t = case t of Arg (A _ i) -> err (const (return t)) return $ xs !? fromInteger i Arg (AB _ _ i) -> err (const (return t)) return $ xs !? fromInteger i |
