Commit d0dcbfe6 authored by Jan Hrček's avatar Jan Hrček

Fix typos and formatting in user guide

parent cf01477f
......@@ -40,7 +40,7 @@ Language
* Record field selectors are now given type signatures that preserve the
user-written order of quantified type variables. Moreover, field selector
type signatures no longer make inferred type variables avaiable for explicit
type signatures no longer make inferred type variables available for explicit
type application. See :ref:`field-selectors-and-type-applications` for more
details.
......@@ -103,7 +103,7 @@ Language
<https://gitlab.haskell.org/ghc/ghc/issues/18126>`_.
* GHC now implements simplified subsumption, as described in `GHC Proposal #287 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0287-simplify-subsumption.rst>`__.
This change simplifies the type system, and prevents the possiblity of GHC
This change simplifies the type system, and prevents the possibility of GHC
silently changing the semantics of user programs, but it does mean that some libraries
may need eta-expansion to typecheck. More info here: :ref:`simple-subsumption`.
......
......@@ -936,7 +936,7 @@ at error generation.
hfPlugin :: [CommandLineOption] -> Maybe HoleFitPlugin
Where ``fromPureHFPlugin :: HoleFitPlugin -> HoleFitPluginR`` is a convencience
Where ``fromPureHFPlugin :: HoleFitPlugin -> HoleFitPluginR`` is a convenience
function provided in the ``TcHoleErrors`` module, for defining plugins that do
not require internal state.
......
......@@ -19,8 +19,7 @@ class type variable, thus: ::
The type of ``elem`` is illegal in Haskell 98, because it contains the
constraint ``Eq a``, which constrains only the class type variable (in
this case ``a``).
this case ``a``). More precisely, a constraint in a class method signature is rejected if
this case ``a``). More precisely, a constraint in a class method signature is rejected if
- The constraint mentions at least one type variable. So this is allowed: ::
......
......@@ -39,7 +39,7 @@ superclass of ``C``.)
With the extension that adds a :ref:`kind of
constraints <constraint-kind>`, you can write more exotic superclass
definitions. The superclass cycle check is even more liberal in these
case. For example, this is OK: ::
cases. For example, this is OK: ::
class A cls c where
meth :: cls c => c -> c
......
......@@ -21,6 +21,7 @@ powers of 16, while the ones to the right correspond to negative ones.
You may also write an explicit exponent, which is similar to the exponent
in decimal notation with the following differences:
- the exponent begins with ``p`` instead of ``e``
- the exponent is written in base ``10`` (**not** 16)
- the base of the exponent is ``2`` (**not** 16).
......
......@@ -6,7 +6,7 @@ Instance declarations and resolution
An instance declaration has the form ::
instance ( assertion1, ..., assertionn) => class type1 ... typem where ...
instance (assertion1, ..., assertionn) => class type1 ... typem where ...
The part before the "``=>``" is the *context*, while the part after the
"``=>``" is the *head* of the instance declaration.
......@@ -74,7 +74,7 @@ GHC relaxes this rule in two ways:
writing the RHS of the type synonym definition. For example: ::
type Point a = (a,a)
instance C (Point a) where ...
instance C (Point a) where ...
is legal. The instance declaration is equivalent to ::
......@@ -382,7 +382,7 @@ like this:
target constraint is a substitution instance of :math:`I`. These instance
declarations are the *candidates*.
- If no candidates remain, the search failes
- If no candidates remain, the search fails
- Eliminate any candidate :math:`IX` for which there is another candidate
:math:`IY` such that both of the following hold:
......@@ -450,7 +450,7 @@ former is a substitution instance of the latter. For example (D) is
"more specific" than (C) because you can get from (C) to (D) by
substituting ``a := Int``.
The final bullet (about unifiying instances)
The final bullet (about unifying instances)
makes GHC conservative about committing to an
overlapping instance. For example: ::
......
......@@ -9,7 +9,7 @@ Nullary type classes
:since: 7.8.1
Allows the use definition of type classes with no parameters. This extension
Allow use and definition of type classes with no parameters. This extension
has been replaced by :extension:`MultiParamTypeClasses`.
......
......@@ -70,7 +70,7 @@ Unboxed type kinds
------------------
Because unboxed types are represented without the use of pointers, we
cannot store them in use a polymorphic datatype at an unboxed type.
cannot store them in a polymorphic datatype.
For example, the ``Just`` node
of ``Just 42#`` would have to be different from the ``Just`` node of
``Just 42``; the former stores an integer directly, while the latter
......@@ -90,7 +90,7 @@ point. In contrast, the kind ``Type`` is actually just a synonym for ``TYPE
'LiftedRep``. More details of the ``TYPE`` mechanisms appear in the `section
on runtime representation polymorphism <#runtime-rep>`__.
Given that ``Int#``'s kind is not ``Type``, it then it follows that ``Maybe
Given that ``Int#``'s kind is not ``Type``, then it follows that ``Maybe
Int#`` is disallowed. Similarly, because type variables tend to be of kind
``Type`` (for example, in ``(.) :: (b -> c) -> (a -> b) -> a -> c``, all the
type variables have kind ``Type``), polymorphism tends not to work over
......@@ -315,7 +315,7 @@ of a `newtype`. For example, the type ::
is accepted when this extension is enabled. This creates a type
``A :: TYPE 'IntRep`` and a data constructor ``MkA :: Int# -> A``.
Although the kind of ``A`` is inferred by GHC, there is nothing visually
distictive about this type that indicated that is it not of kind ``Type``
distinctive about this type that indicated that is it not of kind ``Type``
like newtypes typically are. `GADTSyntax <#gadt-style>`__ can be used to
provide a kind signature for additional clarity ::
......
......@@ -187,10 +187,10 @@ For example: ::
f4 :: (Int -> forall a. (Eq a, Show a) => a -> a) -> Bool
g4 :: Int -> forall x. (Show x, Eq x) => x -> x) -> Bool
Then the application ``f3 g3a`` is well-typed, becuase ``g3a`` has a type that matches the type
Then the application ``f3 g3a`` is well-typed, because ``g3a`` has a type that matches the type
expected by ``f3``. But ``f3 g3b`` is not well typed, because the foralls are in different places.
Nor is ``f3 g3c``, where the foralls are in the same place but the variables are in a different order.
Similarly ``f4 g4`` is not well typed, becuase the constraints appear in a different order.
Similarly ``f4 g4`` is not well typed, because the constraints appear in a different order.
These examples can be made to typecheck by eta-expansion. For example ``f3 (\x -> g3b x)``
is well typed, and similarly ``f3 (\x -> g3c x)`` and ``f4 (\x -> g4 x)``.
......
......@@ -13,7 +13,7 @@ Record wildcards
Allow the use of wildcards in record construction and pattern matching.
Record wildcards are enabled by the language extension :extension:`RecordWildCards`. This
exension implies :extension:`DisambiguateRecordFields`.
extension implies :extension:`DisambiguateRecordFields`.
For records with many fields, it can be tiresome to write out each field
individually in a record pattern, as in ::
......
......@@ -157,7 +157,7 @@ the left hand side can be explicitly bound. For example: ::
data instance forall a (b :: Proxy a). F (Proxy b) = FProxy Bool
When an explicit ``forall`` is present, *all* type and kind variables mentioned
which are not already in scope must be bound by the ``forall``:
which are not already in scope must be bound by the ``forall``: ::
data instance forall (a :: k). F a = FOtherwise -- rejected: k not in scope
data instance forall k (a :: k). F a = FOtherwise -- accepted
......@@ -368,7 +368,7 @@ as for :ref:`data-instance-declarations`.
Also in the same way as :ref:`data-instance-declarations`, when
:extension:`ExplicitForAll` is enabled, type and kind variables can be
explicilty bound in a type instance declaration.
explicitly bound in a type instance declaration.
Type family instance declarations are only legitimate when an
appropriate family declaration is in scope - just like class instances
......@@ -550,7 +550,7 @@ Decidability of type synonym instances
Relax restrictions on the decidability of type synonym family instances.
In order to guarantee that type inference in the presence of type
families decidable, we need to place a number of additional restrictions
families is decidable, we need to place a number of additional restrictions
on the formation of type instance declarations (c.f., Definition 5
(Relaxed Conditions) of “\ `Type Checking with Open Type
Functions <http://www.cse.unsw.edu.au/~chak/papers/SPCS08.html>`__\ ”).
......@@ -661,7 +661,7 @@ keyword in the family instance: ::
The data or type family instance for an associated type must follow
the rule that the type indexes corresponding to class parameters must have
precisely the same as type given in the instance head. For example: ::
precisely the same {- TODO: same what? -} as type given in the instance head. For example: ::
class Collects ce where
type Elem ce :: Type
......@@ -786,49 +786,49 @@ Here are some examples:
type F3 a
type F3 [b] = b -- BAD; only type variables allowed on the
LHS, and the argument to F3 is
instantiated to [b], which is not
a bare type variable
-- LHS, and the argument to F3 is
-- instantiated to [b], which is not
-- a bare type variable
type F4 x y
type F4 x x = x -- BAD; the type variable x is repeated on
the LHS
-- the LHS
type F5 a
type F5 b = a -- BAD; 'a' is not in scope in the RHS
type F6 a :: [k]
type F6 a = ('[] :: [x]) -- OK; the kind variable x is implicitly
bound by an invisible kind pattern
on the LHS
-- bound by an invisible kind pattern
-- on the LHS
type F7 a
type F7 a =
Proxy ('[] :: [x]) -- BAD; the kind variable x is not bound,
even by an invisible kind pattern
-- even by an invisible kind pattern
type F8 (x :: a) :: [a]
type F8 x = ('[] :: [a]) -- OK; the kind variable a is implicitly
bound by the kind signature of the
LHS type pattern
-- bound by the kind signature of the
-- LHS type pattern
type F9 (a :: k)
type F9 a = Maybe a -- BAD; the kind variable k is
instantiated to Type, which is not
a bare kind variable
-- instantiated to Type, which is not
-- a bare kind variable
type F10 (a :: j) (b :: k)
type F10 (a :: z) (b :: z)
= Proxy a -- BAD; the kind variable z is repeated,
-- as both j and k are instantiated to z
-- as both j and k are instantiated to z
type F11 a b
type forall a b. F11 a b = a -- OK; LHS type variables can be
explicitly bound with 'forall'
-- explicitly bound with 'forall'
type F12 (a :: k)
type F12 @k a = Proxy a -- OK; visible kind application syntax is
permitted in default declarations
-- permitted in default declarations
.. _scoping-class-params:
......@@ -900,7 +900,7 @@ Import and export
-----------------
The rules for export lists (Haskell Report `Section
5.2 <http://www.haskell.org/onlinereport/modules.html#sect5.2>`__) needs
5.2 <http://www.haskell.org/onlinereport/modules.html#sect5.2>`__) need
adjustment for type families:
- The form ``T(..)``, where ``T`` is a data family, names the family
......
......@@ -39,7 +39,7 @@ thence ``C Id`` again.
But superclass constraints like these are sometimes useful, and the conservative
check is annoying where no actual recursion is involved.
Moreover genuninely-recursive superclasses are sometimes useful. Here's a real-life
Moreover genuinely-recursive superclasses are sometimes useful. Here's a real-life
example (#10318) ::
class (Frac (Frac a) ~ Frac a,
......
......@@ -1634,7 +1634,7 @@ Because ticky-ticky profiling requires a certain familiarity with GHC
internals, we have moved the documentation to the GHC developers wiki.
Take a look at its
:ghc-wiki:`overview of the profiling options <commentary/profiling>`,
which includeds a link to the ticky-ticky profiling page.
which includes a link to the ticky-ticky profiling page.
.. [1]
:ghc-flag:`-fprof-auto` was known as ``-auto-all`` prior to
......
......@@ -132,7 +132,7 @@ your paths:
- replace ``\`` with ``\\``
- expand relative paths to absolute paths
If you want to opt out of all preprocessing just expliticly use namespaces in
If you want to opt out of all preprocessing just explicitly use namespaces in
your paths. Due to this change, if you need to open raw devices (e.g. COM ports)
you need to use the device namespace explicitly. (e.g. ``\\.\COM1``). GHC and
Haskell programs in general no longer support opening devices in the legacy
......
......@@ -17,7 +17,7 @@
-- Stability : internal
-- Portability : non-portable (GHC extensions)
--
-- This module defines the 'IsLabel' class is used by the
-- This module defines the 'IsLabel' class used by the
-- @OverloadedLabels@ extension. See the
-- <https://gitlab.haskell.org/ghc/ghc/wikis/records/overloaded-record-fields/overloaded-labels wiki page>
-- for more details.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment