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

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -