diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-10 22:51:58 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-13 02:51:13 -0400 |
commit | 70b5eefe09823f77bcfdd7b4fa8dbaee18ab316c (patch) | |
tree | 43f758de6aba15f3ef200ce8458935e5229c3183 /docs | |
parent | 35113117436c4936d97aae90693b93206d9ff213 (diff) | |
download | haskell-70b5eefe09823f77bcfdd7b4fa8dbaee18ab316c.tar.gz |
users-guide: Fix a few markup issues
Strangely these were only causing the build to fail in the aarch64-linux
job, despite Sphinx throwing errors in all jobs I checked.
Also changes some `#ifdef`s to `#if defined` to satisfy the linter.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/ffi-chap.rst | 16 | ||||
-rw-r--r-- | docs/users_guide/ghci.rst | 31 |
2 files changed, 24 insertions, 23 deletions
diff --git a/docs/users_guide/ffi-chap.rst b/docs/users_guide/ffi-chap.rst index 13ea352c8d..e3b6f13710 100644 --- a/docs/users_guide/ffi-chap.rst +++ b/docs/users_guide/ffi-chap.rst @@ -87,7 +87,7 @@ Newtype wrapping of the IO monad The FFI spec requires the IO monad to appear in various places, but it can sometimes be convenient to wrap the IO monad in a ``newtype``, thus: :: - newtype MyIO a = MIO (IO a) + newtype MyIO a = MIO (IO a) (A reason for doing so might be to prevent the programmer from calling arbitrary IO procedures in some part of the program.) @@ -112,15 +112,15 @@ The type variables in the type of a foreign declaration may be quantified with an explicit ``forall`` by using the :extension:`ExplicitForAll` language extension, as in the following example: :: - {-# LANGUAGE ExplicitForAll #-} - foreign import ccall "mmap" c_mmap :: forall a. CSize -> IO (Ptr a) + {-# LANGUAGE ExplicitForAll #-} + foreign import ccall "mmap" c_mmap :: forall a. CSize -> IO (Ptr a) Note that an explicit ``forall`` must appear at the front of the type signature and is not permitted to appear nested within the type, as in the following (erroneous) examples: :: - foreign import ccall "mmap" c_mmap' :: CSize -> forall a. IO (Ptr a) - foreign import ccall quux :: (forall a. Ptr a) -> IO () + foreign import ccall "mmap" c_mmap' :: CSize -> forall a. IO (Ptr a) + foreign import ccall quux :: (forall a. Ptr a) -> IO () .. _ffi-prim: @@ -372,7 +372,7 @@ program. Here's the C code: #include <stdio.h> #include "HsFFI.h" - #ifdef __GLASGOW_HASKELL__ + #if defined(__GLASGOW_HASKELL__) #include "Foo_stub.h" #endif @@ -391,7 +391,7 @@ program. Here's the C code: } We've surrounded the GHC-specific bits with -``#ifdef __GLASGOW_HASKELL__``; the rest of the code should be portable +``#if defined(__GLASGOW_HASKELL__)``; the rest of the code should be portable across Haskell implementations that support the FFI standard. The call to ``hs_init()`` initializes GHC's runtime system. Do NOT try @@ -435,7 +435,7 @@ GHC-specific API instead of ``hs_init()``: #include <stdio.h> #include "HsFFI.h" - #ifdef __GLASGOW_HASKELL__ + #if defined(__GLASGOW_HASKELL__) #include "Foo_stub.h" #include "Rts.h" #endif diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index a5d4aa8a3d..22643be228 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -2582,21 +2582,22 @@ commonly used commands. For example: .. code-block:: none - >:instances Maybe (Maybe Int) - instance Eq (Maybe (Maybe Int)) -- Defined in ‘GHC.Maybe’ - instance Ord (Maybe (Maybe Int)) -- Defined in ‘GHC.Maybe’ - instance Show (Maybe (Maybe Int)) -- Defined in ‘GHC.Show’ - instance Read (Maybe (Maybe Int)) -- Defined in ‘GHC.Read’ - - >:set -XPartialTypeSignatures -fno-warn-partial-type-signatures - - >:instances Maybe _ - instance Eq _ => Eq (Maybe _) -- Defined in ‘GHC.Maybe’ - instance Semigroup _ => Monoid (Maybe _) -- Defined in ‘GHC.Base’ - instance Ord _ => Ord (Maybe _) -- Defined in ‘GHC.Maybe’ - instance Semigroup _ => Semigroup (Maybe _) -- Defined in ‘GHC.Base’ - instance Show _ => Show (Maybe _) -- Defined in ‘GHC.Show’ - instance Read _ => Read (Maybe _) -- Defined in ‘GHC.Read’ + + > :instances Maybe (Maybe Int) + instance Eq (Maybe (Maybe Int)) -- Defined in ‘GHC.Maybe’ + instance Ord (Maybe (Maybe Int)) -- Defined in ‘GHC.Maybe’ + instance Show (Maybe (Maybe Int)) -- Defined in ‘GHC.Show’ + instance Read (Maybe (Maybe Int)) -- Defined in ‘GHC.Read’ + + > :set -XPartialTypeSignatures -fno-warn-partial-type-signatures + + > :instances Maybe _ + instance Eq _ => Eq (Maybe _) -- Defined in ‘GHC.Maybe’ + instance Semigroup _ => Monoid (Maybe _) -- Defined in ‘GHC.Base’ + instance Ord _ => Ord (Maybe _) -- Defined in ‘GHC.Maybe’ + instance Semigroup _ => Semigroup (Maybe _) -- Defined in ‘GHC.Base’ + instance Show _ => Show (Maybe _) -- Defined in ‘GHC.Show’ + instance Read _ => Read (Maybe _) -- Defined in ‘GHC.Read’ .. ghci-cmd:: :main; ⟨arg1⟩ ... ⟨argn⟩ |