diff options
author | Mark Green <mark@antelope.nildram.co.uk> | 2016-08-14 19:39:07 +0100 |
---|---|---|
committer | Mark Green <mark@antelope.nildram.co.uk> | 2016-08-14 19:39:07 +0100 |
commit | 62102d02992f83b3a1fb745a39f36332dd4435b7 (patch) | |
tree | d5ac79ceac2f61e5658aaa826304d87240a20110 /haskell.html.markdown | |
parent | 57053bc95d4166a42da8f6d1732dd21a217b073a (diff) | |
parent | 476de3289df9ef5f72330f3d1359ce9f93d71754 (diff) |
Merge remote-tracking branch 'refs/remotes/adambard/master'
Diffstat (limited to 'haskell.html.markdown')
-rw-r--r-- | haskell.html.markdown | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown index 34eee748..200e2538 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -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 |