summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-05-16 11:31:12 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2016-06-05 11:41:58 -0700
commit886f4c1b1c8ad5b850d3703a48d92975ed615627 (patch)
tree7a2e86a0a3276c1da96df2857a006cabe2446934
parent4848ab9ce3c4491935888d405412d451294b74ee (diff)
downloadhaskell-886f4c1b1c8ad5b850d3703a48d92975ed615627.tar.gz
Better comment for orIfNotFound.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
-rw-r--r--compiler/main/Finder.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/main/Finder.hs b/compiler/main/Finder.hs
index e11480c497..446cdf87e5 100644
--- a/compiler/main/Finder.hs
+++ b/compiler/main/Finder.hs
@@ -141,7 +141,11 @@ findExactModule hsc_env mod =
-- -----------------------------------------------------------------------------
-- Helpers
-orIfNotFound :: IO FindResult -> IO FindResult -> IO FindResult
+-- | Given a monadic actions @this@ and @or_this@, first execute
+-- @this@. If the returned 'FindResult' is successful, return
+-- it; otherwise, execute @or_this@. If both failed, this function
+-- also combines their failure messages in a reasonable way.
+orIfNotFound :: Monad m => m FindResult -> m FindResult -> m FindResult
orIfNotFound this or_this = do
res <- this
case res of