In haskell, combining "case" and ">>=" -


I have a lot of code in style:

  do X & lt; - Get some X-X of this case - & gt; ... that - & gt; ... other - & gt; ...  

Any combination of "x and lt; - ..." and "case x" lines to eliminate the need for a variable in any way?

You can use the bind operator in the x pipe.

  import system. Environment (getArgs) Main :: IO () Main = getArgs & gt; & Gt; = Process where the process ["xxx"] = putStrLn "You have entered xxx" process ["yyy"] = putStrLn "you entered yyy" process _ = putStrLn "error"  

Comments

Popular posts from this blog

google indexing -

php - How to paginate multiple results in CakePHP? -

wpf - Converter stops filter working -