[move rules to Rules/ tree, clean up some code
John Meacham <john@repetae.net>**20070410005202] {
adddir ./src/Rules
move ./src/RuleFunctorM.hs ./src/Rules/FunctorM.hs
move ./src/RuleMonoid.hs ./src/Rules/Monoid.hs
move ./src/RuleUtility.hs ./src/Rules/Utility.hs
move ./src/StandardRules.hs ./src/Rules/Standard.hs
move ./src/UserRuleArbitrary.hs ./src/Rules/Arbitrary.hs
move ./src/UserRuleBinary.hs ./src/Rules/Binary.hs
move ./src/UserRuleBitsBinary.hs ./src/Rules/BitsBinary.hs
move ./src/UserRuleGhcBinary.hs ./src/Rules/GhcBinary.hs
move ./src/UserRuleXml.hs ./src/Rules/Xml.hs
move ./src/UserRulesGeneric.hs ./src/Rules/Generic.hs
addfile ./src/collect_rules.sh
hunk ./src/DrIFT.hs 5
+
hunk ./src/DrIFT.hs 7
-import UserRules
-import StandardRules 
-import RuleUtils (commentLine,texts)
-import PreludData(preludeData)
hunk ./src/DrIFT.hs 8
-import Pretty 
-import List (partition,isSuffixOf,sort, groupBy, sortBy)
-import qualified System
-import IO hiding(try)
+import GenUtil
hunk ./src/DrIFT.hs 10
+import IO hiding(try)
+import List (partition,isSuffixOf,sort, groupBy, sortBy)
hunk ./src/DrIFT.hs 13
+import PreludData(preludeData)
+import Pretty
+import RuleUtils (commentLine,texts)
hunk ./src/DrIFT.hs 18
-import GenUtil
+import qualified Rules(rules)
+import qualified System
hunk ./src/DrIFT.hs 23
-data Env = Env { 
-    envVerbose :: Bool, 
-    envOutput :: (Maybe String), 
-    envOperation :: Op, 
-    envNoline :: Bool, 
+data Env = Env {
+    envVerbose :: Bool,
+    envOutput :: (Maybe String),
+    envOperation :: Op,
+    envNoline :: Bool,
hunk ./src/DrIFT.hs 35
-env = Env { 
-    envVerbose = False, 
+env = Env {
+    envVerbose = False,
hunk ./src/DrIFT.hs 44
-    } 
+    }
hunk ./src/DrIFT.hs 47
-getOutput e = maybe (return stdout) (\fn -> openFile fn WriteMode) (envOutput e) 
+getOutput e = maybe (return stdout) (\fn -> openFile fn WriteMode) (envOutput e)
hunk ./src/DrIFT.hs 58
-    , Option ['g'] ["global"]  (ReqArg addGlobalRule "rule") "addition rules to apply globally"   
-    , Option ['i'] ["ignore"]  (NoArg (\e->e{envIgnoreDirectives = True})) "ignore directives in file. useful with -g"   
+    , Option ['g'] ["global"]  (ReqArg addGlobalRule "rule") "addition rules to apply globally"
+    , Option ['i'] ["ignore"]  (NoArg (\e->e{envIgnoreDirectives = True})) "ignore directives in file. useful with -g"
hunk ./src/DrIFT.hs 74
-    let rn = categorize [(c,(n,h)) | (n,_,c,h,_) <- userRules ++ standardRules]
+    let rn = categorize [(c,(n,h)) | (n,_,c,h,_) <- Rules.rules]
hunk ./src/DrIFT.hs 79
-main = do	
+main = do
hunk ./src/DrIFT.hs 84
-    case env of 
+    case env of
hunk ./src/DrIFT.hs 87
-	_ -> case n of 
+	_ -> case n of
hunk ./src/DrIFT.hs 97
-	let 
+	let
hunk ./src/DrIFT.hs 102
-	let 
-	    result = toLit b . (\r -> codeSeperator ++ '\n':r) . 
+	let
+	    result = toLit b . (\r -> codeSeperator ++ '\n':r) .
hunk ./src/DrIFT.hs 108
-        
+
hunk ./src/DrIFT.hs 112
-    f (_,Directive)  = [] 
+    f (_,Directive)  = []
hunk ./src/DrIFT.hs 117
-rules = map (\(a,b,_,_,_) -> (a,b)) $ userRules ++ standardRules
+rules = map (\(a,b,_,_,_) -> (a,b)) Rules.rules
hunk ./src/DrIFT.hs 148
-   warning = hsep . texts $ ["Warning : Rule",t,"not found."]                 
+   warning = hsep . texts $ ["Warning : Rule",t,"not found."]
hunk ./src/Makefile.am 4
+RULES=  Rules/Arbitrary.hs Rules/Binary.hs Rules/BitsBinary.hs Rules/FunctorM.hs \
+	Rules/Generic.hs Rules/GhcBinary.hs Rules/Monoid.hs Rules/Standard.hs \
+	Rules/Utility.hs Rules/Xml.hs
+
hunk ./src/Makefile.am 9
-DrIFT_SOURCES = ChaseImports.hs CommandP.hs DataP.lhs DrIFT.hs GetOpt.hs \
-   Literate.lhs ParseLib2.hs PreludData.hs Pretty.lhs RuleUtils.hs \
-   StandardRules.hs UserRuleBinary.hs UserRulesGeneric.hs \
-   UserRules.hs UserRuleXml.hs Version.hs GenUtil.hs UserRuleGhcBinary.hs \
-   RuleUtility.hs RuleFunctorM.hs RuleMonoid.hs UserRuleArbitrary.hs \
-   UserRuleBitsBinary.hs
+DrIFT_SOURCES = ${RULES} ChaseImports.hs CommandP.hs DataP.lhs DrIFT.hs GetOpt.hs \
+   Literate.lhs ParseLib2.hs PreludData.hs Pretty.lhs RuleUtils.hs Version.hs GenUtil.hs
hunk ./src/Makefile.am 15
-EXTRA_DIST = depend.make
+EXTRA_DIST = depend.make  Rules.hs collect_rules.sh
hunk ./src/Makefile.am 18
+BUILT_SOURCES=Rules.hs
+
hunk ./src/Makefile.am 23
+Rules.hs: collect_rules.sh
+	sh ./collect_rules.sh > $@
hunk ./src/Rules/Arbitrary.hs 1
-module UserRuleArbitrary (rules) where
+module Rules.Arbitrary(rules) where
hunk ./src/Rules/Arbitrary.hs 3
-import List 
-import RuleUtils 
+import List
+import RuleUtils
hunk ./src/Rules/Arbitrary.hs 14
-			constraints :: [(Class,Var)], 
+			constraints :: [(Class,Var)],
hunk ./src/Rules/Arbitrary.hs 21
-		deriving (Eq,Show) 
+		deriving (Eq,Show)
hunk ./src/Rules/Arbitrary.hs 25
-		    types :: [Type]} deriving (Eq,Show) 
+		    types :: [Type]} deriving (Eq,Show)
hunk ./src/Rules/Arbitrary.hs 67
-                              in text ("  "++show k++" -> do ") 
+                              in text ("  "++show k++" -> do ")
hunk ./src/Rules/Arbitrary.hs 71
+
hunk ./src/Rules/Binary.hs 1
-module UserRuleBinary (userRulesBinary) where
+module Rules.Binary(rules) where
hunk ./src/Rules/Binary.hs 6
-userRulesBinary = [
+rules = [
hunk ./src/Rules/BitsBinary.hs 2
-module UserRuleBitsBinary(userRulesBitsBinary) where
+module Rules.BitsBinary(rules) where
hunk ./src/Rules/BitsBinary.hs 7
-userRulesBitsBinary = [
+rules = [
hunk ./src/Rules/FunctorM.hs 2
-module RuleFunctorM (rules) where
+module Rules.FunctorM (rules) where
hunk ./src/Rules/Generic.hs 2
-module UserRulesGeneric(userRulesGeneric) where
+module Rules.Generic(rules) where
hunk ./src/Rules/Generic.hs 9
-userRulesGeneric :: [RuleDef]
-userRulesGeneric =  [
+rules :: [RuleDef]
+rules =  [
hunk ./src/Rules/GhcBinary.hs 2
-module UserRuleGhcBinary (userRulesGhcBinary) where
+module Rules.GhcBinary (rules) where
hunk ./src/Rules/GhcBinary.hs 7
-userRulesGhcBinary = [
+rules = [
hunk ./src/Rules/Monoid.hs 2
-module RuleMonoid (rules) where
+module Rules.Monoid (rules) where
hunk ./src/Rules/Standard.hs 1
-module StandardRules (standardRules) where
+module Rules.Standard(rules) where
hunk ./src/Rules/Standard.hs 10
-standardRules :: [RuleDef]
-standardRules = [("test",dattest, "Utility", "output raw data for testing", Nothing),
+rules :: [RuleDef]
+rules = [("test",dattest, "Utility", "output raw data for testing", Nothing),
hunk ./src/Rules/Utility.hs 1
-module RuleUtility(rules) where
+module Rules.Utility(rules) where
hunk ./src/Rules/Xml.hs 2
-module UserRuleXml (userRulesXml) where
+module Rules.Xml(rules) where
hunk ./src/Rules/Xml.hs 7
-userRulesXml :: [RuleDef]
-userRulesXml =
+rules :: [RuleDef]
+rules =
hunk ./src/UserRules.hs 1
--- stub module to add your own rules.
-module UserRules(userRules) where
-
-import RuleUtils(RuleDef) -- gives some examples
-
-import qualified RuleFunctorM
-import qualified RuleMonoid
-import qualified RuleUtility
-import UserRuleArbitrary
-import UserRuleBinary
-import UserRuleBitsBinary
-import UserRuleGhcBinary
-import UserRulesGeneric
-import UserRuleXml
-
-
--- add your rules to this list
-userRules :: [RuleDef]
-userRules =
-    userRulesXml ++
-    userRulesBinary ++
-    userRulesBitsBinary ++
-    userRulesGeneric ++
-    userRulesGhcBinary  ++
-    RuleUtility.rules ++
-    RuleFunctorM.rules ++
-    RuleMonoid.rules ++
-    UserRuleArbitrary.rules
-
rmfile ./src/UserRules.hs
hunk ./src/collect_rules.sh 1
+set -e
+
+echo "-- Generated by collect_rules.sh"
+echo
+
+echo "module Rules(rules) where"
+echo
+
+for a in Rules/*; do
+    b=$(echo $a | sed -ne 's/^Rules\/\(.*\)\.l\?hs$/\1/p')
+
+    echo "import qualified Rules.$b";
+
+done;
+echo
+echo "rules = concat"
+
+
+
+for a in Rules/*; do
+    b=$(echo $a | sed -ne 's/^Rules\/\(.*\)\.l\?hs$/\1/p')
+    if test -n "$seen"; then
+    echo "  ,Rules.$b.rules";
+    else
+    echo "  [Rules.$b.rules";
+    seen=1
+    fi
+
+
+done;
+
+echo "   ]";
hunk ./src/depend.make 4
+Version.o : Version.hs
+GenUtil.o : GenUtil.hs
hunk ./src/depend.make 14
-Version.o : Version.hs
hunk ./src/depend.make 18
-UserRuleXml.o : UserRuleXml.hs
-UserRuleXml.o : RuleUtils.hi
-UserRulesGeneric.o : UserRulesGeneric.hs
-UserRulesGeneric.o : RuleUtils.hi
-UserRuleGhcBinary.o : UserRuleGhcBinary.hs
-UserRuleGhcBinary.o : RuleUtils.hi
-UserRuleBitsBinary.o : UserRuleBitsBinary.hs
-UserRuleBitsBinary.o : RuleUtils.hi
-UserRuleBinary.o : UserRuleBinary.hs
-UserRuleBinary.o : RuleUtils.hi
-UserRuleArbitrary.o : UserRuleArbitrary.hs
-UserRuleArbitrary.o : RuleUtils.hi
-RuleMonoid.o : RuleMonoid.hs
-RuleMonoid.o : RuleUtils.hi
-RuleFunctorM.o : RuleFunctorM.hs
-RuleFunctorM.o : RuleUtils.hi
-GenUtil.o : GenUtil.hs
-StandardRules.o : StandardRules.hs
-StandardRules.o : GenUtil.hi
-StandardRules.o : RuleUtils.hi
-RuleUtility.o : RuleUtility.hs
-RuleUtility.o : GenUtil.hi
-RuleUtility.o : RuleUtils.hi
-UserRules.o : UserRules.hs
-UserRules.o : UserRuleXml.hi
-UserRules.o : UserRulesGeneric.hi
-UserRules.o : UserRuleGhcBinary.hi
-UserRules.o : UserRuleBitsBinary.hi
-UserRules.o : UserRuleBinary.hi
-UserRules.o : UserRuleArbitrary.hi
-UserRules.o : RuleUtility.hi
-UserRules.o : RuleMonoid.hi
-UserRules.o : RuleFunctorM.hi
-UserRules.o : RuleUtils.hi
+Rules/Xml.o : Rules/Xml.hs
+Rules/Xml.o : RuleUtils.hi
+Rules/Utility.o : Rules/Utility.hs
+Rules/Utility.o : GenUtil.hi
+Rules/Utility.o : RuleUtils.hi
+Rules/Standard.o : Rules/Standard.hs
+Rules/Standard.o : GenUtil.hi
+Rules/Standard.o : RuleUtils.hi
+Rules/Monoid.o : Rules/Monoid.hs
+Rules/Monoid.o : RuleUtils.hi
+Rules/GhcBinary.o : Rules/GhcBinary.hs
+Rules/GhcBinary.o : RuleUtils.hi
+Rules/Generic.o : Rules/Generic.hs
+Rules/Generic.o : RuleUtils.hi
+Rules/FunctorM.o : Rules/FunctorM.hs
+Rules/FunctorM.o : RuleUtils.hi
+Rules/BitsBinary.o : Rules/BitsBinary.hs
+Rules/BitsBinary.o : RuleUtils.hi
+Rules/Binary.o : Rules/Binary.hs
+Rules/Binary.o : RuleUtils.hi
+Rules/Arbitrary.o : Rules/Arbitrary.hs
+Rules/Arbitrary.o : RuleUtils.hi
+Rules.o : Rules.hs
+Rules.o : Rules/Xml.hi
+Rules.o : Rules/Utility.hi
+Rules.o : Rules/Standard.hi
+Rules.o : Rules/Monoid.hi
+Rules.o : Rules/GhcBinary.hi
+Rules.o : Rules/Generic.hi
+Rules.o : Rules/FunctorM.hi
+Rules.o : Rules/BitsBinary.hi
+Rules.o : Rules/Binary.hi
+Rules.o : Rules/Arbitrary.hi
hunk ./src/depend.make 59
-DrIFT.o : GenUtil.hi
+DrIFT.o : Rules.hi
hunk ./src/depend.make 62
-DrIFT.o : GetOpt.hi
+DrIFT.o : RuleUtils.hi
hunk ./src/depend.make 64
-DrIFT.o : DataP.hi
hunk ./src/depend.make 65
-DrIFT.o : RuleUtils.hi
-DrIFT.o : StandardRules.hi
-DrIFT.o : UserRules.hi
+DrIFT.o : GetOpt.hi
+DrIFT.o : GenUtil.hi
+DrIFT.o : DataP.hi
}
