summaryrefslogtreecommitdiff
path: root/src/GF/Source
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Source')
-rw-r--r--src/GF/Source/SourceToGrammar.hs27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs
index 4af60f1bf..563b9cc97 100644
--- a/src/GF/Source/SourceToGrammar.hs
+++ b/src/GF/Source/SourceToGrammar.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/05/30 21:08:15 $
+-- > CVS $Date: 2005/10/02 20:50:19 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.26 $
+-- > CVS $Revision: 1.27 $
--
-- based on the skeleton Haskell module generated by the BNF converter
-----------------------------------------------------------------------------
@@ -251,15 +251,20 @@ transCatDef x = case x of
cont <- liftM concat $ mapM transDDecl ddecls
return (i, G.AbsCat (yes cont) nope)
listCat id ddecls size = do
- let li = mkListId id
- catd <- cat li ddecls
- let cd = M.mkDecl (G.Vr id)
- lc = G.Vr li
- niltyp = M.mkProdSimple (genericReplicate size cd) lc
- nilfund = (mkBaseId id, G.AbsFun (yes niltyp) nope)
- constyp = M.mkProdSimple [cd, M.mkDecl lc] lc
- consfund = (mkConsId id, G.AbsFun (yes constyp) nope)
- return [catd,nilfund,consfund]
+ let
+ li = mkListId id
+ catd@(_,G.AbsCat (Yes cont0) _) <- cat li ddecls
+ let
+ cont = [(mkId x i,ty) | (i,(x,ty)) <- zip [0..] cont0]
+ xs = map (G.Vr . fst) cont
+ cd = M.mkDecl (M.mkApp (G.Vr id) xs)
+ lc = M.mkApp (G.Vr li) xs
+ niltyp = M.mkProdSimple (cont ++ genericReplicate size cd) lc
+ nilfund = (mkBaseId id, G.AbsFun (yes niltyp) nope)
+ constyp = M.mkProdSimple (cont ++ [cd, M.mkDecl lc]) lc
+ consfund = (mkConsId id, G.AbsFun (yes constyp) nope)
+ return [catd,nilfund,consfund]
+ mkId x i = if isWildIdent x then (mkIdent "x" i) else x
transFunDef :: FunDef -> Err ([Ident], G.Type)
transFunDef x = case x of