[commit: ghc] ghc-8.2: user-guide: fix examples of ghci commands (83e438e)

git at git.haskell.org git at git.haskell.org
Tue Oct 3 21:58:44 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/83e438ee1f52bf8995a2f47f5aa5569d1071e9a0/ghc

>---------------------------------------------------------------

commit 83e438ee1f52bf8995a2f47f5aa5569d1071e9a0
Author: Takenobu Tani <takenobu.hs at gmail.com>
Date:   Thu Aug 17 10:28:01 2017 -0400

    user-guide: fix examples of ghci commands
    
    Fix examples of ghci commands:
      * correct typos
      * add top-level binding without let statement
      * modify Time.getClockTime to Data.Time.getZonedTime
      * modify Directory.setCurrentDirectory
      * modify ghc version number
    
    Test Plan: build
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3852
    
    (cherry picked from commit 3385669683b8bc150c6df3cb43320dfc6f80fcd9)


>---------------------------------------------------------------

83e438ee1f52bf8995a2f47f5aa5569d1071e9a0
 docs/users_guide/ghci.rst  | 29 +++++++++++++++++++----------
 docs/users_guide/using.rst |  4 ++--
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index dce7904..e2fb361 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -37,7 +37,7 @@ command ``ghci``:
 .. code-block:: none
 
     $ ghci
-    GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
+    GHCi, version 8.y.z: http://www.haskell.org/ghc/  :? for help
     Prelude>
 
 There may be a short pause while GHCi loads the prelude and standard
@@ -69,6 +69,15 @@ GHCi, since the expression can also be interpreted in the ``IO`` monad,
 a ``let`` binding with no accompanying ``in`` statement can be signalled
 by an empty line, as in the above example.
 
+Since GHC 8.0.1, you can bind values and functions to names without ``let`` statement:
+
+.. code-block:: none
+
+    Prelude> x = 42
+    Prelude> x
+    42
+    Prelude>
+
 .. _loading-source-files:
 
 Loading source files
@@ -987,10 +996,10 @@ of type ``a``. eg.:
 
 .. code-block:: none
 
-    Prelude> Time.getClockTime
-    Wed Mar 14 12:23:13 GMT 2001
+    Prelude> Data.Time.getZonedTime
+    2017-04-10 12:34:56.93213581 UTC
     Prelude> print it
-    Wed Mar 14 12:23:13 GMT 2001
+    2017-04-10 12:34:56.93213581 UTC
 
 The corresponding translation for an IO-typed ``e`` is
 
@@ -1162,7 +1171,7 @@ printed value. Running GHCi with the command:
 
 .. code-block:: none
 
-    ghci -interactive-print=SpecPrinter.sprinter SpecPrinter
+    ghci -interactive-print=SpecPrinter.sprint SpecPrinter
 
 will start an interactive session where values with be printed using
 ``sprint``:
@@ -1971,7 +1980,7 @@ by using the :ghc-flag:`-package ⟨pkg⟩` flag:
 .. code-block:: none
 
     $ ghci -package readline
-    GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
+    GHCi, version 8.y.z: http://www.haskell.org/ghc/  :? for help
     Loading package base ... linking ... done.
     Loading package readline-1.0 ... linking ... done.
     Prelude>
@@ -2238,17 +2247,17 @@ commonly used commands.
 
     .. code-block:: none
 
-        Prelude> let date _ = Time.getClockTime >>= print >> return ""
+        Prelude> let date _ = Data.Time.getZonedTime >>= print >> return ""
         Prelude> :def date date
         Prelude> :date
-        Fri Mar 23 15:16:40 GMT 2001
+        2017-04-10 12:34:56.93213581 UTC
 
     Here's an example of a command that takes an argument. It's a
     re-implementation of :ghci-cmd:`:cd`:
 
     .. code-block:: none
 
-        Prelude> let mycd d = Directory.setCurrentDirectory d >> return ""
+        Prelude> let mycd d = System.Directory.setCurrentDirectory d >> return ""
         Prelude> :def mycd mycd
         Prelude> :mycd ..
 
@@ -2745,7 +2754,7 @@ commonly used commands.
 	*X> :type +v length
 	length :: forall (t :: * -> *). Foldable t => forall a. t a -> Int
 
-.. ghci-cmd:: :type +d ⟨expression⟩
+.. ghci-cmd:: :type +d; ⟨expression⟩
 
     Infers and prints the type of ⟨expression⟩, defaulting type variables
     if possible. In this mode, if the inferred type is constrained by
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst
index dff9603..6dde0ee 100644
--- a/docs/users_guide/using.rst
+++ b/docs/users_guide/using.rst
@@ -636,8 +636,8 @@ messages and in GHCi:
     .. code-block:: none
 
         ghci> :set -fprint-unicode-syntax
-        ghci> :t (>>)
-        (>>) :: ∀ (m :: * → *) a b. Monad m ⇒ m a → m b → m b
+        ghci> :t +v (>>)
+        (>>) ∷ Monad m ⇒ ∀ a b. m a → m b → m b
 
 .. _pretty-printing-types:
 



More information about the ghc-commits mailing list