diff options
Diffstat (limited to 'haskell.html.markdown')
| -rw-r--r-- | haskell.html.markdown | 25 | 
1 files changed, 20 insertions, 5 deletions
| diff --git a/haskell.html.markdown b/haskell.html.markdown index 2f58b357..4ce1a839 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -81,7 +81,7 @@ not False -- True  [5,4..1] -- [5, 4, 3, 2, 1]  -- indexing into a list -[0..] !! 5 -- 5 +[1..10] !! 3 -- 4  -- You can also have infinite lists in Haskell!  [1..] -- a list of all the natural numbers @@ -193,7 +193,7 @@ foo = (10+)  foo 5 -- 15  -- function composition --- the (.) function chains functions together. +-- 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+) @@ -401,11 +401,26 @@ main'' = do  let foo = 5 --- You can see the type of any value with `:t`: +-- You can see the type of any value or expression with `:t`: ->:t foo +> :t foo  foo :: Integer +-- Operators, such as `+`, `:` and `$`, are functions. +-- Their type can be inspected by putting the operator in parentheses: + +> :t (:) +(:) :: a -> [a] -> [a] + +-- You can get additional information on any `name` using `:i`: + +> :i (+) +class Num a where +  (+) :: a -> a -> a +  ... +    -- Defined in ‘GHC.Num’ +infixl 6 + +  -- You can also run any action of type `IO ()`  > sayHello @@ -426,7 +441,7 @@ qsort (p:xs) = qsort lesser ++ [p] ++ qsort greater            greater = filter (>= p) xs  ``` -Haskell is easy to install. Get it [here](http://www.haskell.org/platform/). +There are two popular ways to install Haskell: The traditional [Cabal-based installation](http://www.haskell.org/platform/), and the newer [Stack-based process](https://www.stackage.org/install).  You can find a much gentler introduction from the excellent  [Learn you a Haskell](http://learnyouahaskell.com/) or | 
