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/runtime/haskell/PGF/Macros.hs | |
| parent | 72cc4ddb594599a5e3768a7b3921975542c3591a (diff) | |
refactor the API for random generation again. Now PGF contains probabilities in the abstract syntax
Diffstat (limited to 'src/runtime/haskell/PGF/Macros.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/Macros.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/haskell/PGF/Macros.hs b/src/runtime/haskell/PGF/Macros.hs index ae984cfdf..40c2a754f 100644 --- a/src/runtime/haskell/PGF/Macros.hs +++ b/src/runtime/haskell/PGF/Macros.hs @@ -21,18 +21,18 @@ mapConcretes f pgf = pgf { concretes = Map.map f (concretes pgf) } lookType :: PGF -> CId -> Type lookType pgf f = case lookMap (error $ "lookType " ++ show f) f (funs (abstract pgf)) of - (ty,_,_) -> ty + (ty,_,_,_) -> ty lookDef :: PGF -> CId -> Maybe [Equation] lookDef pgf f = case lookMap (error $ "lookDef " ++ show f) f (funs (abstract pgf)) of - (_,a,eqs) -> eqs + (_,a,eqs,_) -> eqs isData :: PGF -> CId -> Bool isData pgf f = case Map.lookup f (funs (abstract pgf)) of - Just (_,_,Nothing) -> True -- the encoding of data constrs - _ -> False + Just (_,_,Nothing,_) -> True -- the encoding of data constrs + _ -> False lookValCat :: PGF -> CId -> CId lookValCat pgf = valCat . lookType pgf @@ -65,7 +65,7 @@ lookConcrFlag pgf lang f = Map.lookup f $ cflags $ lookConcr pgf lang functionsToCat :: PGF -> CId -> [(CId,Type)] functionsToCat pgf cat = - [(f,ty) | f <- fs, Just (ty,_,_) <- [Map.lookup f $ funs $ abstract pgf]] + [(f,ty) | (_,f) <- fs, Just (ty,_,_,_) <- [Map.lookup f $ funs $ abstract pgf]] where (_,fs) = lookMap ([],[]) cat $ cats $ abstract pgf @@ -81,7 +81,7 @@ restrictPGF :: (CId -> Bool) -> PGF -> PGF restrictPGF cond pgf = pgf { abstract = abstr { funs = Map.filterWithKey (\c _ -> cond c) (funs abstr), - cats = Map.map (\(hyps,fs) -> (hyps,filter cond fs)) (cats abstr) + cats = Map.map (\(hyps,fs) -> (hyps,filter (cond . snd) fs)) (cats abstr) } } ---- restrict concrs also, might be needed where |
