Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Frequency: drop harmful 'fail'

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
  • Loading branch information...
commit 4ce22357c651b6636a3107a09af3d0ded5ca774c 1 parent e2e3602
@kiryl authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  src/Frequency.hs
View
3  src/Frequency.hs
@@ -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

@Mikolaj

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.
Something went wrong with that request. Please try again.