20-CS-4003-001 Organization of Programming Languages Fall 2017

Lambda calculus, Type theory, Formal semantics, Program analysis

Prev     Next     All lectures           Code


main = 
  putStrLn "What is your name?" >> 
  getLine >>= 
  (\name -> putStrLn ("My name is " ++ name))
  -   A more evident way of obtaining the same result as in the previous slide. The pipeline structure of operators >> and >>= ensures that the getLine and putStrLn operations are evaluated only once and in the given order. The language may perform out-of-order or lazy evaluations but the pipeline remains intact.