diff options
| author | bringert <unknown> | 2005-09-14 14:17:29 +0000 |
|---|---|---|
| committer | bringert <unknown> | 2005-09-14 14:17:29 +0000 |
| commit | a8bc5590afe8951cb473854a6b701464f11db2d7 (patch) | |
| tree | aec845ad4a93fe6264ea7d9aa72930e5fb03bd45 /src/GF/Speech/TransformCFG.hs | |
| parent | 16f2bf8cd6b0a5925988fc91e18f3af5246dfc98 (diff) | |
Added Graphviz module for graphviz stuff. Move a lot of utility functions to GF.Data.Utilities.
Diffstat (limited to 'src/GF/Speech/TransformCFG.hs')
| -rw-r--r-- | src/GF/Speech/TransformCFG.hs | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs index a32da82fe..84feae845 100644 --- a/src/GF/Speech/TransformCFG.hs +++ b/src/GF/Speech/TransformCFG.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/09/12 16:10:23 $ +-- > CVS $Date: 2005/09/14 15:17:30 $ -- > CVS $Author: bringert $ --- > CVS $Revision: 1.21 $ +-- > CVS $Revision: 1.22 $ -- -- This module does some useful transformations on CFGs. -- @@ -23,12 +23,13 @@ module GF.Speech.TransformCFG {- (CFRule_, CFRules, removeLeftRecursion, removeEmptyCats, removeIdenticalRules) -} where -import GF.Infra.Ident +import GF.Conversion.Types +import GF.Data.Utilities import GF.Formalism.CFG import GF.Formalism.Utilities (Symbol(..), mapSymbol, filterCats, symbol, NameProfile(..)) -import GF.Conversion.Types -import GF.Infra.Print +import GF.Infra.Ident import GF.Infra.Option +import GF.Infra.Print import GF.Speech.FiniteState import Control.Monad @@ -36,8 +37,6 @@ import Data.FiniteMap import Data.List import Data.Maybe (fromJust, fromMaybe) -import Debug.Trace - -- | not very nice to replace the structured CFCat type with a simple string type CFRule_ = CFRule Cat_ Name Token @@ -135,26 +134,4 @@ anyUsedBy cs (CFRule _ ss _) = any (`elem` cs) (filterCats ss) mkName :: String -> Name mkName n = Name (IC n) [] --- --- * Utilities --- - -findSet :: Eq c => c -> [[c]] -> Maybe [c] -findSet x = find (x `elem`) - -fix :: Eq a => (a -> a) -> a -> a -fix f x = let x' = f x in if x' == x then x else fix f x' - -nothingOrNull :: Maybe [a] -> Bool -nothingOrNull Nothing = True -nothingOrNull (Just xs) = null xs - -unionAll :: Eq a => [[a]] -> [a] -unionAll = nub . concat - -whenMP :: MonadPlus m => Bool -> a -> m a -whenMP b x = if b then return x else mzero - -lookup' :: Eq a => a -> [(a,b)] -> b -lookup' x = fromJust . lookup x |
