[convert more fail to throwError
Helmut Grohne <grohne@cs.uni-bonn.de>**20150211101130
 Ignore-this: f5a1f6c5580639cc2f621284e7a84bb3
 
 All of these are only reachable when enabling "enhanced". Then they crash igor,
 because they fail in a Monad that is not a MonadError, but they are meant to be
 caught with catchError.
] hunk ./src/Igor2/RuleDevelopment/Cata.hs 64
-oneOrNone _ []     = fail "No more applicable!"
+oneOrNone _ []     = throwError . strMsg $ "No more applicable!"
hunk ./src/Igor2/RuleDevelopment/Cata.hs 92
-  (dataTypeName i (crul cr) >>= ctorsOf >>= partByCtors i evi >>= mkMorphism withP i cr)  `catchError` (\e -> noMorph withP i e)
+  (dataTypeName i (crul cr) >>= ctorsOf >>= partByCtors i evi >>= mkMorphism withP i cr)  `catchError` (\e -> noMorph withP e)
hunk ./src/Igor2/RuleDevelopment/Cata.hs 99
-    noMorph p i e = fail $ (if p then "Para" else "Cata") ++ 
-                           "morphism not applicable for argument " ++ 
-                           (show i) ++ "! Universal Property not satisfied: " ++
-                           (show e)
+    noMorph p e = throwError . strMsg $ (if p then "Para" else "Cata") ++
+                           "morphism not applicable for argument " ++
+                           show i ++ "! Universal Property not satisfied: " ++
+                           show e
hunk ./src/Igor2/RuleDevelopment/ListCata.hs 41
-                             
-noFoldCall :: Int -> IM [(CovrRules,[Call])]
-noFoldCall i = fail . show $ (text "ListCata not applicable!" <+>
-                              text "Universal Property for argument" <+> int i <+> text "not satisfied!")
+
+noFoldCall :: Int -> IM [(CovrRules, [Call])]
+noFoldCall i = throwError . strMsg . show $
+    (text "ListCata not applicable!" <+> text "Universal Property for argument" <+> int i <+> text "not satisfied!")
hunk ./src/Igor2/RuleDevelopment/ListCata.hs 238
--}    
-definedOnNil :: (Monad m) => Int -> [CovrRule] -> m (CovrRule,[CovrRule])
-definedOnNil i = exactly1Base . partition (isNilList . (ithArg i) . crul)
+-}
+definedOnNil :: (Error e, MonadError e m) => Int -> [CovrRule] -> m (CovrRule, [CovrRule])
+definedOnNil i = exactly1Base . partition (isNilList . ithArg i . crul)
hunk ./src/Igor2/RuleDevelopment/ListCata.hs 245
-    onlyOne _   = fail "Not only one"
-        
-    -- onlyOne l 
+    onlyOne _   = throwError . strMsg $ "Not only one"
+
+    -- onlyOne l
hunk ./src/Igor2/RuleDevelopment/ListCata.hs 291
-    xs'    <- evalIO (name cr) (insertAt i xs args) >>= 
-               maybe (fail "Insufficient support in Examples") return
-    let io = rule (args ++ [x,xs']) (rhs . crul $  cr) 
-    if not . hasFreeVars $ io then return io else fail "Open vars in abduced examples!")
-    `catchError` \e -> fail $ "Insufficient suport in examples!" ++ (show e)
+    xs'    <- evalIO (name cr) (insertAt i xs args) >>=
+               maybe (throwError . strMsg $ "Insufficient support in Examples") return
+    let io = rule (args ++ [x,xs']) (rhs . crul $  cr)
+    if not . hasFreeVars $ io then return io else throwError . strMsg $ "Open vars in abduced examples!")
+    `catchError` \e -> throwError . strMsg $ "Insufficient suport in examples!" ++ show e
hunk ./src/Syntax/Type.hs 44
+import Control.Monad.Error (Error, MonadError, strMsg, throwError)
hunk ./src/Syntax/Type.hs 89
-dataName :: (Monad m) => Type -> m Name
+dataName :: (Error e, MonadError e m) => Type -> m Name
hunk ./src/Syntax/Type.hs 91
-dataName (VarT _)        = fail "dataName: Variable!"
+dataName (VarT _)        = throwError . strMsg $ "dataName: Variable!"