remove some dead types from GF.Grammar.Grammar

This commit is contained in:
krasimir
2009-01-20 14:33:42 +00:00
parent 36c757b076
commit c8e924707c
5 changed files with 10 additions and 19 deletions

View File

@@ -43,9 +43,6 @@ module GF.Grammar.Grammar (SourceGrammar,
Param,
Altern,
Substitution,
Branch(..),
Con,
Trm,
wildPatt,
varLabel, tupleLabel, linLabel, theLinLabel,
ident2label, label2ident
@@ -233,10 +230,6 @@ type Altern = (Term, [(Term, Term)])
type Substitution = [(Ident, Term)]
-- | branches à la Alfa
newtype Branch = Branch (Con,([Ident],Term)) deriving (Eq, Ord,Show,Read)
type Con = Ident ---
varLabel :: Int -> Label
varLabel = LVar
@@ -256,5 +249,3 @@ label2ident (LVar i) = identC (BS.pack ('$':show i))
wildPatt :: Patt
wildPatt = PV identW
type Trm = Term

View File

@@ -405,7 +405,7 @@ freshMeta :: [MetaSymb] -> MetaSymb
freshMeta ms = MetaSymb (minimum [n | n <- [0..length ms],
notElem n (map metaSymbInt ms)])
mkFreshMetasInTrm :: [MetaSymb] -> Trm -> Trm
mkFreshMetasInTrm :: [MetaSymb] -> Term -> Term
mkFreshMetasInTrm metas = fst . rms minMeta where
rms meta trm = case trm of
Meta m -> (Meta (MetaSymb meta), meta + 1)

View File

@@ -38,8 +38,8 @@ unifyVal cs0 = do
(_,VClos (_:_) _) -> True
_ -> False
type Unifier = [(MetaSymb, Trm)]
type Constrs = [(Trm, Trm)]
type Unifier = [(MetaSymb, Term)]
type Constrs = [(Term, Term)]
unifyAll :: Constrs -> Unifier -> (Unifier,Constrs)
unifyAll [] g = (g, [])
@@ -49,7 +49,7 @@ unifyAll ((a@(s, t)) : l) g =
Ok g2 -> (g2, c)
_ -> (g1, a : c)
unify :: Trm -> Trm -> Unifier -> Err Unifier
unify :: Term -> Term -> Unifier -> Err Unifier
unify e1 e2 g =
case (e1, e2) of
(Meta s, t) -> do
@@ -67,12 +67,12 @@ unify e1 e2 g =
_ -> prtBad "fail unify" e1
_ -> prtBad "fail unify" e1
extend :: Unifier -> MetaSymb -> Trm -> Err Unifier
extend :: Unifier -> MetaSymb -> Term -> Err Unifier
extend g s t | (t == Meta s) = return g
| occCheck s t = prtBad "occurs check" t
| True = return ((s, t) : g)
subst_all :: Unifier -> Trm -> Err Trm
subst_all :: Unifier -> Term -> Err Term
subst_all s u =
case (s,u) of
([], t) -> return t
@@ -80,14 +80,14 @@ subst_all s u =
t' <- (subst_all l t) --- successive substs - why ?
return $ substMetas [a] t'
substMetas :: [(MetaSymb,Trm)] -> Trm -> Trm
substMetas :: [(MetaSymb,Term)] -> Term -> Term
substMetas subst trm = case trm of
Meta x -> case lookup x subst of
Just t -> t
_ -> trm
_ -> composSafeOp (substMetas subst) trm
occCheck :: MetaSymb -> Trm -> Bool
occCheck :: MetaSymb -> Term -> Bool
occCheck s u = case u of
Meta v -> s == v
App c a -> occCheck s c || occCheck s a