Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1afa860

Browse files
committedJan 28, 2022
haskell/core-libraries-committee#33 : Remove uses of MonadFail (ST _)
There was a use of `fail` for `Maybe` which is entirely pointless.
1 parent 2c757b5 commit 1afa860

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
 

‎lib/Data/IntMap/EnumMap2.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ notMember k (EnumMap m) = M.notMember (fromEnum k) m
5050

5151
{-# INLINE lookup #-}
5252
lookup :: (Enum key) => key -> EnumMap key a -> Maybe a
53-
lookup k (EnumMap m) = maybe (fail "EnumMap.lookup failed") return $ M.lookup (fromEnum k) m
53+
lookup k (EnumMap m) = M.lookup (fromEnum k) m
5454

5555
findWithDefault :: (Enum key) => a -> key -> EnumMap key a -> a
5656
findWithDefault a k (EnumMap m) = M.findWithDefault a (fromEnum k) m

‎lib/Text/Regex/TDFA/NewDFA/Engine.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ execMatch r@(Regex { regex_dfa = DFA {d_id=didIn,d_dt=dtIn}
285285
challenge x1@((_si1,ins1),_p1,_o1) x2@((_si2,ins2),_p2,_o2) = {-# SCC "goNext.findTrans.challenge" #-} do
286286
check <- comp offset x1 (newPos ins1) x2 (newPos ins2)
287287
if check==LT then return x2 else return x1
288-
(first:rest) <- mapM prep (IMap.toList sources)
288+
first_rest <- mapM prep (IMap.toList sources)
289+
let first:rest = first_rest
289290
set which destIndex =<< foldM challenge first rest
290291
let dl = IMap.toList dtrans
291292
mapM_ findTransTo dl

‎lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ execMatch (Regex { regex_dfa = DFA {d_id=didIn,d_dt=dtIn}
240240
challenge x1@((_si1,ins1),_p1,_o1) x2@((_si2,ins2),_p2,_o2) = {-# SCC "goNext.findTrans.challenge" #-} do
241241
check <- comp offset x1 (newPos ins1) x2 (newPos ins2)
242242
if check==LT then return x2 else return x1
243-
(first:rest) <- mapM prep (IMap.toList sources)
243+
first_rest <- mapM prep (IMap.toList sources)
244+
let first:rest = first_rest
244245
set which destIndex =<< foldM challenge first rest
245246
let dl = IMap.toList dtrans
246247
mapM_ findTransTo dl

0 commit comments

Comments
 (0)
Please sign in to comment.