rename Decl in GF.Grammar.Grammar to Hypo to match the convention in PGF

This commit is contained in:
krasimir
2009-09-20 10:15:39 +00:00
parent 1dfa67a30a
commit 94068df3fb
4 changed files with 15 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ module GF.Grammar.Grammar (SourceGrammar,
TInfo(..),
Label(..),
MetaSymb(..),
Decl,
Hypo,
Context,
Equation,
Labelling,
@@ -200,8 +200,8 @@ data Label =
newtype MetaSymb = MetaSymb Int deriving (Read, Show, Eq, Ord)
type Decl = (Ident,Term) -- (x:A) (_:A) A
type Context = [Decl] -- (x:A)(y:B) (x,y:A) (_,_:A)
type Hypo = (Ident,Term) -- (x:A) (_:A) A
type Context = [Hypo] -- (x:A)(y:B) (x,y:A) (_,_:A)
type Equation = ([Patt],Term)
type Labelling = (Label, Term)

View File

@@ -276,8 +276,8 @@ mkCTable :: [Ident] -> Term -> Term
mkCTable ids v = foldr ccase v ids where
ccase x t = T TRaw [(PV x,t)]
mkDecl :: Term -> Decl
mkDecl typ = (identW, typ)
mkHypo :: Term -> Hypo
mkHypo typ = (identW, typ)
eqStrIdent :: Ident -> Ident -> Bool
eqStrIdent = (==)

View File

@@ -540,10 +540,10 @@ ListBind
: Bind { [$1] }
| Bind ',' ListBind { $1 : $3 }
Decl :: { [Decl] }
Decl :: { [Hypo] }
Decl
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
| Exp4 { [mkDecl $1] }
| Exp4 { [mkHypo $1] }
ListTupleComp :: { [Term] }
ListTupleComp
@@ -575,12 +575,12 @@ ListAltern
: Altern { [$1] }
| Altern ';' ListAltern { $1 : $3 }
DDecl :: { [Decl] }
DDecl :: { [Hypo] }
DDecl
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
| Exp6 { [mkDecl $1] }
| Exp6 { [mkHypo $1] }
ListDDecl :: { [Decl] }
ListDDecl :: { [Hypo] }
ListDDecl
: {- empty -} { [] }
| DDecl ListDDecl { $1 ++ $2 }
@@ -615,11 +615,11 @@ listCatDef id pos cont size = [catd,nilfund,consfund]
cont' = [(mkId x i,ty) | (i,(x,ty)) <- zip [0..] cont]
xs = map (Vr . fst) cont'
cd = mkDecl (mkApp (Vr id) xs)
cd = mkHypo (mkApp (Vr id) xs)
lc = mkApp (Vr listId) xs
niltyp = mkProdSimple (cont' ++ replicate size cd) lc
constyp = mkProdSimple (cont' ++ [cd, mkDecl lc]) lc
constyp = mkProdSimple (cont' ++ [cd, mkHypo lc]) lc
mkId x i = if isWildIdent x then (varX i) else x

View File

@@ -55,17 +55,17 @@ checkCond s b = if b then return () else checkError s
checkWarn :: Message -> Check ()
checkWarn msg = Check (\ctxt msgs -> Success () ctxt ((text "Warning:" <+> msg) : msgs))
checkUpdate :: Decl -> Check ()
checkUpdate :: Hypo -> Check ()
checkUpdate d = Check (\ctxt msgs -> Success () (d:ctxt) msgs)
checkInContext :: [Decl] -> Check r -> Check r
checkInContext :: [Hypo] -> Check r -> Check r
checkInContext g ch = do
i <- checkUpdates g
r <- ch
checkResets i
return r
checkUpdates :: [Decl] -> Check Int
checkUpdates :: [Hypo] -> Check Int
checkUpdates ds = mapM checkUpdate ds >> return (length ds)
checkReset :: Check ()