summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <adam@adambard.com>2013-06-29 15:37:45 -0700
committerAdam <adam@adambard.com>2013-06-29 15:38:04 -0700
commit7135adbd49eb24c7b0a89de3f5cb78c638bbe4f4 (patch)
tree7bfdff2b790c1b87f7d94eceeb2aa9c0b5a2e9fa
parent0a65fd6171b7543b1f31e147d207b33504344a26 (diff)
parentc84881bc9d8c3c8907bff303fc9d999bbfedcbce (diff)
Updated clojure. Fixes #54
-rw-r--r--haskell.html.markdown27
1 files changed, 26 insertions, 1 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 563674c9..fbaa93f2 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -259,7 +259,32 @@ Just "hello"
Just 1
----------------------------------------------------
--- 8. The Haskell REPL
+-- 8. Haskell IO
+----------------------------------------------------
+
+-- While IO can't be explained fully without explaining monads
+-- it is not hard to explain enough to get going
+
+-- An IO a value is an IO action: you can chain them with do blocks
+action = do
+ putStrLn "This is a line. Duh"
+ input <- getLine -- this gets a line and gives it the name "input"
+ input2 <- getLine
+ return (input1++"\n"++input2) -- This is the result of the whole action
+
+-- This didn't actually do anything. When a haskell program is executed
+-- an IO action called "main" is read and interprete
+
+main = do
+ putStrLn "Our first program. How exciting!"
+ result <- action -- our defined action is just like the default ones
+ putStrLn result
+ putStrLn "This was all, folks!"
+
+
+
+----------------------------------------------------
+-- 9. The Haskell REPL
----------------------------------------------------
-- Start the repl by typing `ghci`.