@@ -137,7 +137,7 @@ Unlike Haskell, there is no restriction on whether types and function
137names must begin with a capital letter or not. Function names
137names must begin with a capital letter or not. Function names
138(``plus`` and ``mult`` above), data constructors (``Z``, ``S``,
138(``plus`` and ``mult`` above), data constructors (``Z``, ``S``,
139``Nil`` and ``::``) and type constructors (``Nat`` and ``List``) are
139``Nil`` and ``::``) and type constructors (``Nat`` and ``List``) are
140−all part of the same namespace. By convention, however,
140+all part of the same namespace. By convention, however,
141data types and constructor names typically begin with a capital letter.
141data types and constructor names typically begin with a capital letter.
142We can test these functions at the Idris prompt:
142We can test these functions at the Idris prompt:
@@ -495,9 +495,20 @@ vector. For example:
495 testVec : Vect 4 Int
495 testVec : Vect 4 Int
496 testVec = 3 :: 4 :: 5 :: 6 :: Nil
496 testVec = 3 :: 4 :: 5 :: 6 :: Nil
498− inVect : IsElem 5 testVec
498+ inVect : IsElem 5 Main.testVec
499 inVect = There (There Here)
499 inVect = There (There Here)
502+.. important:: Implicit Arguments and Scope
504+ Within the type signature the typechecker will treat all variables
505+ that start with an lowercase letter **and** are not applied to
506+ something else as an implicit variable. To get the above code
507+ example to compile you will need to provide a qualified name for
508+ ``testVec``. In the example above, we have assumed that the code
509+ lives within the ``Main`` module.
501If the same implicit arguments are being used a lot, it can make a
512If the same implicit arguments are being used a lot, it can make a
502definition difficult to read. To avoid this problem, a ``using`` block
513definition difficult to read. To avoid this problem, a ``using`` block
503gives the types and ordering of any implicit arguments which can
514gives the types and ordering of any implicit arguments which can
@@ -510,6 +521,8 @@ appear within the block:
510 Here : IsElem x (x :: xs)
521 Here : IsElem x (x :: xs)
511 There : IsElem x xs -> IsElem x (y :: xs)
522 There : IsElem x xs -> IsElem x (y :: xs)
513Note: Declaration Order and ``mutual`` blocks
526Note: Declaration Order and ``mutual`` blocks
514~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
527~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -583,7 +596,7 @@ example for reading and writing files, including:
584 openFile : (f : String) -> (m : Mode) -> IO (Either FileError File)
597 openFile : (f : String) -> (m : Mode) -> IO (Either FileError File)
585 closeFile : File -> IO ()
598 closeFile : File -> IO ()
587 fGetLine : (h : File) -> IO (Either FileError String)
600 fGetLine : (h : File) -> IO (Either FileError String)
588 fPutStr : (h : File) -> (str : String) -> IO (Either FileError ())
601 fPutStr : (h : File) -> (str : String) -> IO (Either FileError ())
589 fEOF : File -> IO Bool
602 fEOF : File -> IO Bool