Permalink
Browse files

Frequency: drop harmful 'fail'

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
  • Loading branch information...
1 parent e2e3602 commit 4ce22357c651b6636a3107a09af3d0ded5ca774c @kiryl committed Oct 2, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/Frequency.hs
View
@@ -8,9 +8,8 @@ newtype Frequency a = Frequency { runFrequency :: [(Int, a)] }
instance Monad Frequency where
return x = Frequency [(1, x)]
m >>= f = Frequency
- [(p * q, y) | (p, x) <- runFrequency m,
+ [(p * q, y) | (p, x) <- runFrequency m,
(q, y) <- runFrequency (f x) ]
- fail "" = Frequency []
instance MonadPlus Frequency where
mplus (Frequency xs) (Frequency ys) = Frequency (xs ++ ys)

1 comment on commit 4ce2235

Agreed. With the pattern match warnings turned on (in Allure, but I hope in the future in LambdaHack, too), I'd rather fix the warning than let 'fail' ever fire off.

Please sign in to comment.