mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-08-02 01:15:12 -06:00
strip some redundant constructors from GF.Grammar.Grammar
This commit is contained in:
@@ -136,7 +136,6 @@ trm2str :: Term -> Err Term
|
||||
trm2str t = case t of
|
||||
R ((_,(_,s)):_) -> trm2str s
|
||||
T _ ((_,s):_) -> trm2str s
|
||||
TSh _ ((_,s):_) -> trm2str s
|
||||
V _ (s:_) -> trm2str s
|
||||
C _ _ -> return $ t
|
||||
K _ -> return $ t
|
||||
|
||||
@@ -311,20 +311,15 @@ computeTermOpt rec gr = comput True where
|
||||
|
||||
-- course-of-values table: look up by index, no pattern matching needed
|
||||
|
||||
V ptyp ts -> case v' of
|
||||
Val _ _ i -> comp g $ ts !! i
|
||||
_ -> do
|
||||
V ptyp ts -> do
|
||||
vs <- allParamValues gr ptyp
|
||||
case lookupR v' (zip vs [0 .. length vs - 1]) of
|
||||
Just i -> comp g $ ts !! i
|
||||
_ -> return $ S t' v' -- if v' is not canonical
|
||||
T _ cc -> do
|
||||
let v2 = case v' of
|
||||
Val te _ _ -> te
|
||||
_ -> v'
|
||||
case matchPattern cc v2 of
|
||||
case matchPattern cc v' of
|
||||
Ok (c,g') -> comp (g' ++ g) c
|
||||
_ | isCan v2 -> Bad (render (text "missing case" <+> ppTerm Unqualified 0 v2 <+> text "in" <+> ppTerm Unqualified 0 t))
|
||||
_ | isCan v' -> Bad (render (text "missing case" <+> ppTerm Unqualified 0 v' <+> text "in" <+> ppTerm Unqualified 0 t))
|
||||
_ -> return $ S t' v' -- if v' is not canonical
|
||||
|
||||
S (T i cs) e -> prawitz g i (flip S v') cs e
|
||||
|
||||
@@ -90,8 +90,6 @@ inferLType gr g trm = case trm of
|
||||
checkError (text "cannot infer type of canonical constant" <+> ppTerm Unqualified 0 trm)
|
||||
]
|
||||
|
||||
Val _ ty i -> termWith trm $ return ty
|
||||
|
||||
Vr ident -> termWith trm $ checkLookup ident g
|
||||
|
||||
Typed e t -> do
|
||||
|
||||
Reference in New Issue
Block a user