From 94068df3fbbdb1087894abe4f35889e88283b87d Mon Sep 17 00:00:00 2001 From: krasimir Date: Sun, 20 Sep 2009 10:15:39 +0000 Subject: [PATCH] rename Decl in GF.Grammar.Grammar to Hypo to match the convention in PGF --- src/GF/Grammar/Grammar.hs | 6 +++--- src/GF/Grammar/Macros.hs | 4 ++-- src/GF/Grammar/Parser.y | 14 +++++++------- src/GF/Infra/CheckM.hs | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/GF/Grammar/Grammar.hs b/src/GF/Grammar/Grammar.hs index bfe676b57..6abe24264 100644 --- a/src/GF/Grammar/Grammar.hs +++ b/src/GF/Grammar/Grammar.hs @@ -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) diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs index 6749f1bc9..72f0eb10a 100644 --- a/src/GF/Grammar/Macros.hs +++ b/src/GF/Grammar/Macros.hs @@ -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 = (==) diff --git a/src/GF/Grammar/Parser.y b/src/GF/Grammar/Parser.y index 89614ed8d..90e035a02 100644 --- a/src/GF/Grammar/Parser.y +++ b/src/GF/Grammar/Parser.y @@ -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 diff --git a/src/GF/Infra/CheckM.hs b/src/GF/Infra/CheckM.hs index f701b7c3a..efa65118b 100644 --- a/src/GF/Infra/CheckM.hs +++ b/src/GF/Infra/CheckM.hs @@ -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 ()