diff options
Diffstat (limited to 'src/GF/Devel/Macros.hs')
| -rw-r--r-- | src/GF/Devel/Macros.hs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/GF/Devel/Macros.hs b/src/GF/Devel/Macros.hs index 8e6e5d78f..afaf71c52 100644 --- a/src/GF/Devel/Macros.hs +++ b/src/GF/Devel/Macros.hs @@ -33,9 +33,24 @@ appForm tr = (f,reverse xs) where mkProd :: Context -> Type -> Type mkProd = flip (foldr (uncurry Prod)) +mkApp :: Term -> [Term] -> Term +mkApp = foldl App + +mkAbs :: [Ident] -> Term -> Term +mkAbs xs t = foldr Abs t xs + +mkDecl :: Term -> Decl +mkDecl typ = (wildIdent, typ) + typeType :: Type typeType = Sort "Type" +ident2label :: Ident -> Label +ident2label c = LIdent (prIdent c) + +----label2ident :: Label -> Ident +----label2ident = identC . prLabel + -- to apply a term operation to every term in a judgement, module, grammar termOpGF :: Monad m => (Term -> m Term) -> GF -> m GF @@ -56,12 +71,10 @@ termOpJudgement :: Monad m => (Term -> m Term) -> Judgement -> m Judgement termOpJudgement f j = do jtyp <- f (jtype j) jde <- f (jdef j) - jli <- f (jlin j) jpri <- f (jprintname j) return $ j { jtype = jtyp, jdef = jde, - jlin = jli, jprintname = jpri } |
