@@ -46,11 +46,14 @@ implementations of the function for a specific type. For example, the
4646 Idris> show (S (S (S Z)))
4747 "sssZ" : String
4848
49−Only one instance of a class can be given for a type — instances may not
50−overlap. Instance declarations can themselves have constraints. For
51−example, to define a ``Show`` instance for vectors, we need to know that
52−there is a ``Show`` instance for the element type, because we are going
53−to use it to convert each element to a ``String``:
49+Only one instance of a class can be given for a type — instances may
50+not overlap. Instance declarations can themselves have constraints.
51+To help with resolution, the arguments of an instance must be
52+constructors (either data or type constructors), variables or
53+constants (i.e. you cannot give an instance for a function). For
54+example, to define a ``Show`` instance for vectors, we need to know
55+that there is a ``Show`` instance for the element type, because we are
56+going to use it to convert each element to a ``String``:
5457
5558.. code-block:: idris
5659
@@ -487,6 +490,25 @@ instance ``myord`` as follows, at the ``Idris`` prompt:
487490 "[ssssO, sssO, sO]" : String
488491
489492
493+Determining Parameters
494+----------------------
495+
496+When a class has more than one parameter, it can help resolution if
497+the parameters used to resolve the type class are restricted. For
498+example:
499+
500+.. code-block:: idris
501+
502+ class Monad m => MonadState s (m : Type -> Type) | m where
503+ get : m s
504+ put : s -> m ()
505+
506+In this class, only ``m`` needs to be known to resolve this class, and
507+``s`` can then be determined from the instance. This is declared with
508+the ``| m`` after the class declaration. We call ``m`` a *determining
509+parameter* of the ``MonadState`` class, because it is the parameter
510+used to resolve an instance.
511+
490512
491513.. [1] Conor Mcbride and Ross Paterson. 2008. Applicative programming
492514 with effects. J. Funct. Program. 18, 1 (January 2008),