some dead code elimination in UseIO and ReadFiles

This commit is contained in:
krasimir
2009-01-31 20:36:41 +00:00
parent 6133fcbb5f
commit 0e1215a8f1
4 changed files with 17 additions and 78 deletions

View File

@@ -21,7 +21,7 @@ module GF.Data.Operations (-- * misc functions
Err(..), err, maybeErr, testErr, errVal, errIn,
lookupErr,
mapPairListM, mapPairsM, pairM,
(!?), singleton, mapsErr, mapsErrTree,
singleton, mapsErr, mapsErrTree,
-- ** checking
checkUnique,
@@ -77,7 +77,6 @@ infixr 5 +++
infixr 5 ++-
infixr 5 ++++
infixr 5 +++++
infixl 9 !?
ifNull :: b -> ([a] -> b) -> [a] -> b
ifNull b f xs = if null xs then b else f xs
@@ -118,10 +117,6 @@ mapPairsM f xys = mapM (\ (x,y) -> liftM ((,) x) (f y)) xys
pairM :: Monad a => (b -> a c) -> (b,b) -> a (c,c)
pairM op (t1,t2) = liftM2 (,) (op t1) (op t2)
-- @!!@ with the error monad
(!?) :: [a] -> Int -> Err a
xs !? i = foldr (const . return) (Bad "too few elements in list") $ drop i xs
singleton :: a -> [a]
singleton = (:[])