on master help sign in
Merge pull request #3004 from jhegedus42/patch-1

Update typesfuns.rst - extra documentation for implicit pattern matching - because it was not clear (to me) how pattern matching for implicit works.

commitf86f86c82359395b7fea78d3780be257dc1ed62e authorEdwin Brady <edwin.brady@gmail.com> dateThu 24 Mar 2016, 17:14 (11 years ago) parent1ff57d4fdac0f1
1 file changed+10
docs/tutorial/typesfuns.rst+10
docs/tutorial/typesfuns.rst+10
@@ -469,6 +469,16 @@ It is a matter of taste whether you want to do this — sometimes it can
469469help document a function by making the purpose of an argument more
470470clear.
471471
472+Furthermore, ``{}`` can be used to pattern match on the left hand side, i.e.
473+``{var = pat}`` gets an implicit variable and attempts to pattern match on "pat";
474+For example :
475+
476+.. code-block:: idris
477+
478+ isEmpty : Vect n a -> Bool
479+ isEmpty {n = Z} _ = True
480+ isEmpty {n = S k} _ = False
481+
472482“``using``” notation
473483--------------------
474484