diff options
| author | krasimir <krasimir@chalmers.se> | 2010-10-02 13:03:57 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-10-02 13:03:57 +0000 |
| commit | cb8795c222ae86e4561e1009c382fe0b87e22b62 (patch) | |
| tree | eddba3e578a812347060f5f640cc49e58dc5b263 /src/compiler/GF/Compile/PGFtoProlog.hs | |
| parent | 72cc4ddb594599a5e3768a7b3921975542c3591a (diff) | |
refactor the API for random generation again. Now PGF contains probabilities in the abstract syntax
Diffstat (limited to 'src/compiler/GF/Compile/PGFtoProlog.hs')
| -rw-r--r-- | src/compiler/GF/Compile/PGFtoProlog.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/GF/Compile/PGFtoProlog.hs b/src/compiler/GF/Compile/PGFtoProlog.hs index d5839916b..9f456ca93 100644 --- a/src/compiler/GF/Compile/PGFtoProlog.hs +++ b/src/compiler/GF/Compile/PGFtoProlog.hs @@ -62,22 +62,22 @@ plAbstract (name, Abstr aflags funs cats) = clauseHeader "%% def(?Fun, ?Expr)" (concatMap plFundef (Map.assocs funs)) -plCat :: (CId, ([Hypo],[CId])) -> String +plCat :: (CId, ([Hypo],[(Double,CId)])) -> String plCat (cat, (hypos,_)) = plFact "cat" (plTypeWithHypos typ) where ((_,subst), hypos') = mapAccumL alphaConvertHypo emptyEnv hypos args = reverse [EFun x | (_,x) <- subst] typ = DTyp hypos' cat args -plFun :: (CId, (Type, Int, Maybe [Equation])) -> String -plFun (fun, (typ,_,_)) = plFact "fun" (plp fun : plTypeWithHypos typ') +plFun :: (CId, (Type, Int, Maybe [Equation], Double)) -> String +plFun (fun, (typ,_,_,_)) = plFact "fun" (plp fun : plTypeWithHypos typ') where typ' = snd $ alphaConvert emptyEnv typ plTypeWithHypos :: Type -> [String] plTypeWithHypos (DTyp hypos cat args) = [plTerm (plp cat) (map plp args), plList (map (\(_,x,ty) -> plOper ":" (plp x) (plp ty)) hypos)] -plFundef :: (CId, (Type,Int,Maybe [Equation])) -> [String] -plFundef (fun, (_,_,Nothing )) = [] -plFundef (fun, (_,_,Just eqs)) = [plFact "def" [plp fun, plp fundef']] +plFundef :: (CId, (Type,Int,Maybe [Equation],Double)) -> [String] +plFundef (fun, (_,_,Nothing ,_)) = [] +plFundef (fun, (_,_,Just eqs,_)) = [plFact "def" [plp fun, plp fundef']] where fundef' = snd $ alphaConvert emptyEnv eqs |
