thanks for your quick answer ! Then what's the advantage using such a `case` not using `if` statement given by you ? For me, the `if` statement is more clear .
jmillikin wrote: > > Sorry; forgot to CC the list > > That case is equivalent to: > > if filex > then return $ Just $ file x > else if filex' > then return $ Just $ file' x > else findHelper xs > > > The specific syntax being used is called a "pattern guard": > http://www.haskell.org/haskellwiki/Pattern_guard > > On Tue, Dec 8, 2009 at 16:59, zaxis <[email protected]> wrote: >> >> findHelper (x:xs) = do -- not lazy, but that's not really important here >> filex <- fileExists (file x) >> filex' <- fileExists (file' x) >> case () of >> _ >> | filex -> return $ Just $ file x >> | filex' -> return $ Just $ file' x >> | otherwise -> findHelper xs >> file x = foldl1 joinFileName (x ++ [helper]) >> file' x = (file x) ++ (getConfig "exe_ext") >> >> Sincerely! >> >> ----- >> fac n = foldr (*) 1 [1..n] >> -- >> View this message in context: >> http://old.nabble.com/How-to-understand-such-a-%60case%60---tp26703526p26703526.html >> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> [email protected] >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ----- fac n = foldr (*) 1 [1..n] -- View this message in context: http://old.nabble.com/How-to-understand-such-a-%60case%60---tp26703526p26703743.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
