diff options
author | sarthfrey <sarth.frey@gmail.com> | 2016-01-25 18:26:23 -0500 |
---|---|---|
committer | sarthfrey <sarth.frey@gmail.com> | 2016-01-25 18:26:23 -0500 |
commit | 279c28ce7dcc3f155f71c7a073e939630e8f05b6 (patch) | |
tree | cd06525da5a4350916143f025b2e5a64a56922aa /haskell.html.markdown | |
parent | 299d064ecf7598144e49ef336e0abd00ccc4ae16 (diff) | |
parent | 928edf12092cea82a9eded6848b8d0b0710a977c (diff) |
Merge remote-tracking branch 'adambard/master'
# Conflicts:
# python.html.markdown
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 |