注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
Have you ever wanted to do case expr of regexhere -> ... ? You can do almost that with view patte... Have you ever wanted to do case expr of regexhere -> ... ? You can do almost that with view patterns! {-# LANGUAGE ViewPatterns #-} import Text.Regex.Posix -- Helper pat :: String -> String -> [[String]] pat p s = s =~ p -- Function with matching foo :: String -> String foo (pat "foo(bar|baz)" -> [[_,x]]) = x foo _ = "no!" main :: IO () main = do print $ foo "foobar" print $ foo "foobaz" print $ f
2013/09/07 リンク