From ad930bf0477988f76af85633aef8e7a75774ee34 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 28 Jun 2016 15:04:04 -0400 Subject: [PATCH] Tidy up with fromMaybe. --- src/Data/RandomWalkSimilarity.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Data/RandomWalkSimilarity.hs b/src/Data/RandomWalkSimilarity.hs index ba45ff8b1..7b04c3c73 100644 --- a/src/Data/RandomWalkSimilarity.hs +++ b/src/Data/RandomWalkSimilarity.hs @@ -38,10 +38,7 @@ rws compare getLabel as bs then pure $! insert v else do put (Set.insert k mapped) - case compare nearest v of - Just y -> do - pure y - _ -> pure $! replace nearest v + pure $! fromMaybe (replace nearest v) (compare nearest v) deleteRemaining diff mapped = diff <> (delete . snd <$> filter (not . (`Set.member` mapped) . fst) fas) data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] }