summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorven <vendethiel@hotmail.fr>2016-02-11 16:54:21 +0100
committerven <vendethiel@hotmail.fr>2016-02-11 16:54:21 +0100
commit67b36fb8fe592e0fb7287d497a7ee9111f7f80d2 (patch)
treec7ce1ca143c64def6cb32284e5c116d61465289d
parent1abd652f357376df31832040a961e561d088fcf4 (diff)
parentf6b8b079b49a1fcfdc6143fc51bc5d3738ade8f0 (diff)
Merge pull request #1758 from patrikja/patch-2
Some minor fixes
-rw-r--r--haskell.html.markdown18
1 files changed, 9 insertions, 9 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 200e2538..4ce1a839 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -189,16 +189,16 @@ foo = add 10 -- foo is now a function that takes a number and adds 10 to it
foo 5 -- 15
-- Another way to write the same thing
-foo = (+10)
+foo = (10+)
foo 5 -- 15
-- function composition
-- the operator `.` chains functions together.
-- For example, here foo is a function that takes a value. It adds 10 to it,
-- multiplies the result of that by 4, and then returns the final value.
-foo = (*4) . (+10)
+foo = (4*) . (10+)
--- (5 + 10) * 4 = 60
+-- 4*(10 + 5) = 60
foo 5 -- 60
-- fixing precedence
@@ -222,7 +222,7 @@ even . fib $ 7 -- false
-- 5. Type signatures
----------------------------------------------------
--- Haskell has a very strong type system, and everything has a type signature.
+-- Haskell has a very strong type system, and every valid expression has a type.
-- Some basic types:
5 :: Integer
@@ -259,7 +259,7 @@ case args of
_ -> putStrLn "bad args"
-- Haskell doesn't have loops; it uses recursion instead.
--- map applies a function over every element in an array
+-- map applies a function over every element in a list
map (*2) [1..5] -- [2, 4, 6, 8, 10]
@@ -279,7 +279,7 @@ foldl (\x y -> 2*x + y) 4 [1,2,3] -- 43
-- This is the same as
(2 * (2 * (2 * 4 + 1) + 2) + 3)
--- foldl is left-handed, foldr is right-
+-- foldl is left-handed, foldr is right-handed
foldr (\x y -> 2*x + y) 4 [1,2,3] -- 16
-- This is now the same as
@@ -318,7 +318,7 @@ Nothing -- of type `Maybe a` for any `a`
-- it is not hard to explain enough to get going.
-- When a Haskell program is executed, `main` is
--- called. It must return a value of type `IO ()`. For example:
+-- called. It must return a value of type `IO a` for some type `a`. For example:
main :: IO ()
main = putStrLn $ "Hello, sky! " ++ (say Blue)
@@ -361,7 +361,7 @@ sayHello = do
-- You can think of a value of type `IO a` as representing a
-- computer program that will generate a value of type `a`
-- when executed (in addition to anything else it does). We can
--- store and reuse this value using `<-`. We can also
+-- name and reuse this value using `<-`. We can also
-- make our own action of type `IO String`:
action :: IO String
@@ -432,7 +432,7 @@ Hello, Friend!
There's a lot more to Haskell, including typeclasses and monads. These are the
big ideas that make Haskell such fun to code in. I'll leave you with one final
-Haskell example: an implementation of quicksort in Haskell:
+Haskell example: an implementation of a quicksort variant in Haskell:
```haskell
qsort [] = []